調べてみましたが、JSL 内からシステム環境設定を取得する簡単な方法が見つかりませんでした。私は Mac (JMP 14 および 15) で開発していますが、Windows でこれを行う方法も知りたいと思っています。私が最も近いのは、言語コードを取得する方法に関するディスカッションでした。
System Service( Get Language Code );
System Service sounds like and interesting function, but I couldn't find any documentation on it. I'm looking for a general solution but am immediately interested in finding the date format, (per setting in System Preferences ➔ Language & Region ➔ Advanced... ➔ Dates ➔ Short), as shown below:

The 短い date delimiters are normally set to slashes by default, but were modified by me to dashes in the image above. The specific issue I find with changing this setting is that it affects what arguments are valid to the Input Format function. For example, the following statement will generate a runtime error:
col << Input Format( "y/m/d h:m:s" );
したがって、コードは次のようにする必要があります。
col << Input Format( "y-m-d h:m:s" );
And the reverse it true if the user has their System Preferences set to slashes. Furthermore, with the Format function, if the wrong date string is given, there won't be a runtime error, but the relevant datetime column will ignore the format setting, and the data will be left in its raw, unintelligible form.
したがって、有効な引数のセットはユーザーの設定に依存し、コードは最初にこの設定を読み取って、使用する形式を決定する必要があります。
回避策として、システム Unix コマンドから設定情報を収集し、それに応じて解析することができました。
// implement Unix command:
// $ defaults read com.apple.mail DateCellWidthCache | grep M.d.yy
Clear Log();
// read System Preferences from 'defaults' that contains date format string.
sDefaults = Run Program(
Executable( "/usr/bin/defaults" ),
Options( { "read", "com.apple.mail", "DateCellWidthCache" } ),
Read Function( "text" )
);
//Write( sDefaults );
ss1 = Munger( sDefaults, 1, "M/d/yy" ); // check for slash style.
ss2 = Munger( sDefaults, 1, "M-d-yy" ); // check for dash style.
Show( ss1, ss2 ); Write("\!n");
If( ss1 > 0,
Write( "Using slashes.\!n");
,
/* else if */ ss2 > 0,
Write( "Using dashes.\!n");
,
/* else */
Write( "***ERROR: unrecognized date delimiter.\!n");
Write( "defaults read com.apple.mail DateCellWidthCache:\!n");
Write( sDefaults );
);ただし、これは少し不器用なようで、もっと簡単な方法があると思います。以下に示すように、この設定に基づいて [列プロパティ] ダイアログに非常に異なる時間形式のセットが表示されるため、JMP エンジンがこの設定を読み取ることができることは明らかです (ここではダッシュ オプションのみを示しています)。

So, my question is: Is there a simple way to get arbitrary System Preferences values (and the date format specifically) by using System Service or some other function?