最后更新于
最后更新于
The ScriptConfig object is accessed via the .config and the .config properties. The .config property allows a script (in its method) to specify what configuration properties it supports, and provide default values for them. The properties assigned in will then be available in Preferences for the user to edit, and the user-edited configuration can then be accessed by other script methods using .config.
<configuration property>
variant
The properties of the ScriptConfig object are entirely determined by the script itself.
In the OnInit method, assign the default values of any configuration properties you want to this object. The type of each default value controls the type of the property.
The Preferences page only supports editing certain types of variables, so you must only assign properties of compatible types. Preferences supports:
Boolean options (True or False) - the variable type must be bool
Numeric options - the variable type must be int
String options - the variable type must be string
Multi-line string options - the variable type must be string and must contain at least one CR/LF pair. Note that a trailing CR/LF will be removed from the default value.
Multiple string options - the variable type must be a of strings
Drop-down list - the variable type must be a with an int as the first element (to specify the default selection), and strings for the remaining elements.