ScriptConfig

The ScriptConfig object is accessed via the ScriptInitData.config and the Script.config properties. The ScriptInitData.config property allows a script (in its OnInit method) to specify what configuration properties it supports, and provide default values for them. The properties assigned in OnInit 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 Script.config.
 

Property Name

Return Type

Description

<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 Vector of strings
  • Drop-down list - the variable type must be a Vector with an int as the first element (to specify the default selection), and strings for the remaining elements.