ファイルとファイルシステムのローカルとグローバルプロパティ
ここで説明するローカルプロパティとグローバルプロパティは、SenseTalkスクリプトがファイルやファイルシステムオブジェクトにアクセスしたり、それらと対話したりする方法に影響します。SenseTalkでファイルやファイルシステムを操作するための追加情報については、File and Folder ReferencesとFile and Folder Interactionを参照してください。
ローカルプロパティとグローバルプロパティの値を設定または変更する:
SenseTalkのコマンド Set
または Put
を使用してグローバルプロパティの値を設定できます。これらのプロパティを参照するときは、通常の変数と区別するためにプロパティ名の前に the
を使用しなけ ればなりません。
例:
set the searchrectangle to [1,2,2,3]
put 2 into the remoteworkinterval
このようにしてグローバルプロパティ内の特定の名前付きプロパティを追加または変更できます:
set the namedColors.pink to color("RGB,1.0,0.5,0.5") -- Adds pink to the namedColors global property and defines its RGB color value
set the listFormat's separator to " & " -- Sets the separator property of the listFormat global property
プロパティは、setoption
または setoptions
コマンドを使用して設定または更新することもできます。setoption
コマンドでは一つのプロパティを更新でき、setoptions
コマンドでは複数のプロパティを更新できます。
例:
setoption searchrectangle, [1,2,2,3]
setoptions {searchrectangle: [1,2,2,3], scriptlogging: yes}
setoption
および setoptions
は、グローバルプロパティおよびローカルプロパティの使用に特化しているため、これらのコマンドのコマンド構文でプロパティ名から the
を省略します。
ローカルプロパティとグローバルプロパティの操作についての追加情報については、SenseTalkのローカルプロパティとグローバルプロパティを参照してください。
the folder
, the directory
Global Properties
値: 現在の作業ディレクトリのパス
デフォルト: 典型的にはドキュメントフォルダへのパスですが、この値はPreferencesのGeneralセクションのDefault Suite Directory設定を更新することで変更可能です。
振る舞い: このプロパティを使用すると、現在の作業フォルダにアクセスしたり、その値を変更したりできます。the folder
によって返される値は、the folderNamesEndWithSlash
グローバルプロパティがfalseに設定されていない限り、スラッシュで終わります。この最後のスラッシュは、以下の例に示すように、ファイル名を追加することでフルパス名を簡単に作成できるようにします。
SenseTalkスクリプト内では、folder
とdirectory
は同じ意味で使用されます。スクリプト中でfolder
という語が使用されている場所では、代わりにdirectory
という語を使用できます。
例:
set the directory to "C:\Users\Carrie\Desktop\"
例:
set the folder to "C:\Users\Carrie\Desktop\"
例:
set the directory to "C:\Users\Carrie\Desktop\data\"
put the files of the folder into fileObjects // Returns a list of the file objects for any files in the current working directory and stores them in a variable