Using Global Variables

Scripts always have access to a number of global variables. The list of available variables depends on the type of script. The Script component supplies only a few global variables, while model customization scripts have more global variables.

The available global variables for each type of script are described in the following sections:

The global variables behave identically in both the Jython and DynamicJava languages in that you call methods on these objects in the standard way. Methods may return objects that can be further processed.

For example, a component customization script has access to the DtComponent object for the component being customized, as a global variable component. In Jython, you could get a property of the component and change its value as follows:

prop = component.getProperty('script')
prop.getValueObj().setValue('# a new, empty script')

In this script, component is the name of the global variable that holds the DtComponent object.

In the script editor interface, global variables are always shown as underlined to make it clear that they are not standard script variables or parameters.

Do not assign a new value to a global variable. For example:

localDir = new File("foo/bar");   // Don't do this!