Understanding the Built-in CLI Functions

The following built-in functions enable your scripts to interact with the system.

Table 1-9 Built-in Functions to Support System Interactions

Function Description

children

Returns an array of static children. See Using the Children Function.

choices

Returns an array of the valid property values for any property for which the set of values is known and enumerable. See Using the Choices Function.

createalert, postalert

Creates or posts a custom alert. See Using the Custom Alert Functions.

get

Gets the value of the specified property. Note that this function returns the value in native form. For example, dates are returned as Date objects. See Using the Get Function.

list

Returns an array of tokens corresponding to the dynamic children of the current context. See Using the List Function.

prop

Returns the value of the specified property in the current node context, or sets the specified property to a specified value. Both input and output values are in scriptable format. The values returned by prop might differ from values returned by get. See Using the Prop Function.

props

Returns an array of the property names for the current node.

run

Runs the specified command in the shell, returning any output as a string. Note that if the output contains multiple lines, the returned string will contain embedded newlines. See Using the Run Function.

set

Takes two string arguments, setting the specified property to the specified value.