dollar-object
Dollar ($) object
Section titled “Dollar ($) object”This global ExtendScript object provides a number of debugging facilities and informational methods. The properties of the $ object allow you to get global information such as the most recent run-time error, and set flags that control debugging and localization behavior. The methods allow you to output text to the JavaScript Console during script execution, control execution and other ExtendScript behavior programmatically, and gather statistics on object use.
Attributes
Section titled “Attributes”$.appEncoding
Section titled “$.appEncoding”$.appEncoding
Description
Section titled “Description”The Internet name of the application’s default character encoding, such as “CP1252” or “X-SHIFT-JIS”. Valid values are implementation- and OS-dependent.
Set to change the default encoding for the application. The returned value can differ from the value set. In Windows, for example, if set to “x-latin1”, the returned value is the synonymous “ISO-8859-1”.
String
$.build
Section titled “$.build”$.build
Description
Section titled “Description”String
The version information for the current ExtendScript build.
Read only.
$.buildDate
Section titled “$.buildDate”$.buildDate
Description
Section titled “Description”Date
The date the current JavaScript engine was built.
Read only.
$.decimalPoint
Section titled “$.decimalPoint”$.decimalPoint
Description
Section titled “Description”String
The character used in formatted numeric output for a decimal point, for the current locale.
Read only.
$.engineName
Section titled “$.engineName”$.engineName
Description
Section titled “Description”String
The name of the current JavaScript engine, if set.
Read only.
$.error
Section titled “$.error”$.error
Description
Section titled “Description”Error
String
The most recent run-time error information, contained in a JavaScript Error object.
Assigning error text to this property generates a run-time error; however, the preferred way to generate a run-time error is to throw an Error object.
$.fileName
Section titled “$.fileName”$.fileName
Description
Section titled “Description”String
The file name of the current script.
Read only.
$.flags
Section titled “$.flags”$.flags
Description
Section titled “Description”Number
Gets or sets low-level debug output flags. A logical AND of the following bit flag values:
0x0002
(2): Displays each line with its line number as it is executed.0x0040
(64): Enables excessive garbage collection. Usually, garbage collection starts when the number of objects has increased by a certain amount since the last garbage collection. This flag causes ExtendScript to garbage collect after almost every statement. This impairs performance severely, but is useful when you suspect that an object gets released too soon.0x0080
(128): Displays all calls with their arguments and the return value.0x0100
(256): Enables extended error handling (see strict).0x0200
(512): Enables the localization feature of the toString method. Equivalent to the localize property.
$.global
Section titled “$.global”$.global
Description
Section titled “Description”Provides access to the Global object, which contains the JavaScript global namespace.
Global
$.hiresTimer
Section titled “$.hiresTimer”$.hiresTimer
Description
Section titled “Description”A high-resolution timer that measures the number of microseconds since this property was last accessed. Value is initialized as early as possible, so the first access returns the startup time for ExtendScript. The property is thread-local; that is, the first access on a thread returns the time needed to create and initialize that thread.
Number. Read only.
$.includePath
Section titled “$.includePath”$.includePath
Description
Section titled “Description”The path for include files for the current script.
String. Read only.
$.level
Section titled “$.level”$.level
Description
Section titled “Description”The current debugging level, which enables or disables the JavaScript debugger.
Number. Read only. One of:
0
: No debugging1
: Break on runtime errors2
: Full debug mode
$.line
Section titled “$.line”$.line
Description
Section titled “Description”The current line of the currently executing script; the first line is number 1.
Number. Read only.
$.locale
Section titled “$.locale”$.locale
Description
Section titled “Description”Gets or sets the current locale. The string contains five characters in the form LL_RR, where LL is an ISO 639 language specifier, and RR is an ISO 3166 region specifier.
Initially, this is the value that the application or the platform returns for the current user. You can set it to temporarily change the locale for testing. To return to the application or platform setting, set to Nothing, null
, or the empty string.
String
$.localize
Section titled “$.localize”$.localize
Description
Section titled “Description”Enable or disable the extended localization features of the built-in toString()
method.
See Localizing ExtendScript strings.
Boolean
$.memCache
Section titled “$.memCache”$.memCache
Description
Section titled “Description”Gets or sets the ExtendScript memory cache size in bytes.
Number
$.os
Description
Section titled “Description”The current operating system version information.
String. Read only.
$.screens
Section titled “$.screens”$.screens
Description
Section titled “Description”An array of objects containing information about the display screens attached to your computer.
Array of objects
Properties
Section titled “Properties”Property | Type | Description |
---|---|---|
left | Coordinate | The left corner of the drawable area |
top | Coordinate | The top corner of the drawable area |
right | Coordinate | The right corner of the drawable area |
bottom | Coordinate | The bottom corner of the drawable area |
primary | Boolean | true if the object describes the primary display |
$.stack
Section titled “$.stack”$.stack
Description
Section titled “Description”The current stack trace.
String
$.strict
Section titled “$.strict”$.strict
Description
Section titled “Description”When true
, any attempt to write to a read-only property causes a runtime error.
Some objects do not permit the creation of new properties when true
.
Boolean
$.version
Section titled “$.version”$.version
Description
Section titled “Description”The version number of the JavaScript engine as a three-part number and description; for example: “3.92.95 (debug)“
String. Read only.
Methods
Section titled “Methods”$.about()
Section titled “$.about()”$.about()
Description
Section titled “Description”Displays the About box for the ExtendScript component, and returns the text of the About box as a string.
Returns
Section titled “Returns”String
$.bp()
Section titled “$.bp()”$.bp([condition])
Description
Section titled “Description”Executes a breakpoint at the current position.
If no condition is needed, it is recommended that you use the JavaScript debugger;
statement in the script, rather than this method.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
condition | String | Optional. The JavaScript statement to be used as a condition. If the statement evaluates to true or nonzero when this point is reached, execution stops. |
Returns
Section titled “Returns”Nothing
$.colorPicker()
Section titled “$.colorPicker()”$.colorPicker(name)
Description
Section titled “Description”Invokes the platform-specific color selection dialog
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
name | Hexadecimal RGB value (0xRRGGBB ) | The color to be preselected in the dialog, or -1 for the platform default. |
Returns
Section titled “Returns”Hexadecimal RGB value, e.g. 0xRRGGBB
.
$.evalFile()
Section titled “$.evalFile()”$.evalFile(path[, timeout=10000])
Description
Section titled “Description”Loads a JavaScript script file from disk, evaluates it, and returns the result of evaluation.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
path | String | The name and location of the file. |
timeout | Number | Optional. A number of milliseconds to wait before returning undefined, if the script cannot be evaluated. Defaults to 10000 . |
Returns
Section titled “Returns”Any type
$.gc()
Section titled “$.gc()”$.gc()
Description
Section titled “Description”Initiates garbage collection in the JavaScript engine.
Returns
Section titled “Returns”Nothing
$.getenv()
Section titled “$.getenv()”$.getenv(envname)
Description
Section titled “Description”Retrieves the value of the specified environment variable, or null if no such variable is defined.
Any env vars set in .bash_profile, .bashrc, .profile, .zshenv, or .zshrc will be ignored.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
envname | String | The name of the environment variable. |
Returns
Section titled “Returns”String
$.setenv()
Section titled “$.setenv()”$.setenv(envname, value)
Description
Section titled “Description”Sets the value of the specified environment variable, if no such variable is defined.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
envname | String | The name of the environment variable. |
value | String | The new value, a string. |
Returns
Section titled “Returns”Nothing
$.sleep()
Section titled “$.sleep()”$.sleep(milliseconds)
Description
Section titled “Description”Suspends the calling thread for the given number of milliseconds.
During a sleep period, checks at 100
millisecond intervals to see whether the sleep should be terminated. This can happen if there is a break request, or if the script timeout has expired.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
milliseconds | Number | The number of milliseconds to wait. |
Returns
Section titled “Returns”Nothing
$.write()
Section titled “$.write()”$.write(text[, text...]...)
Description
Section titled “Description”Writes the specified text to the JavaScript Console.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
text | String | One or more strings to write, which are concatenated to form a single string. |
Returns
Section titled “Returns”Nothing
$.writeln()
Section titled “$.writeln()”$.writeln (text[, text...]...)
Description
Section titled “Description”Writes the specified text to the JavaScript Console and appends a linefeed sequence.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
text | String | One or more strings to write, which are concatenated to form a single string. |
Returns
Section titled “Returns”Nothing