Skip to content

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.


$.appEncoding

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

String

The version information for the current ExtendScript build.

Read only.


$.buildDate

Date

The date the current JavaScript engine was built.

Read only.


$.decimalPoint

String

The character used in formatted numeric output for a decimal point, for the current locale.

Read only.


$.engineName

String

The name of the current JavaScript engine, if set.

Read only.


$.error

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

String

The file name of the current script.

Read only.


$.flags

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

Provides access to the Global object, which contains the JavaScript global namespace.

Global


$.hiresTimer

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

The path for include files for the current script.

String. Read only.


$.level

The current debugging level, which enables or disables the JavaScript debugger.

Number. Read only. One of:

  • 0: No debugging
  • 1: Break on runtime errors
  • 2: Full debug mode

$.line

The current line of the currently executing script; the first line is number 1.

Number. Read only.


$.locale

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

Enable or disable the extended localization features of the built-in toString() method.

See Localizing ExtendScript strings.

Boolean


$.memCache

Gets or sets the ExtendScript memory cache size in bytes.

Number


$.os

The current operating system version information.

String. Read only.


$.screens

An array of objects containing information about the display screens attached to your computer.

Array of objects

PropertyTypeDescription
leftCoordinateThe left corner of the drawable area
topCoordinateThe top corner of the drawable area
rightCoordinateThe right corner of the drawable area
bottomCoordinateThe bottom corner of the drawable area
primaryBooleantrue if the object describes the primary display

$.stack

The current stack trace.

String


$.strict

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

The version number of the JavaScript engine as a three-part number and description; for example: “3.92.95 (debug)“

String. Read only.


$.about()

Displays the About box for the ExtendScript component, and returns the text of the About box as a string.

String


$.bp([condition])

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.

ParameterTypeDescription
conditionStringOptional. The JavaScript statement to be used as a condition. If the statement evaluates to true or nonzero when this point is reached, execution stops.

Nothing


$.colorPicker(name)

Invokes the platform-specific color selection dialog

ParameterTypeDescription
nameHexadecimal RGB value (0xRRGGBB)The color to be preselected in the dialog, or -1 for the platform default.

Hexadecimal RGB value, e.g. 0xRRGGBB.


$.evalFile(path[, timeout=10000])

Loads a JavaScript script file from disk, evaluates it, and returns the result of evaluation.

ParameterTypeDescription
pathStringThe name and location of the file.
timeoutNumberOptional. A number of milliseconds to wait before returning undefined, if the script cannot be evaluated. Defaults to 10000.

Any type


$.gc()

Initiates garbage collection in the JavaScript engine.

Nothing


$.getenv(envname)

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.

ParameterTypeDescription
envnameStringThe name of the environment variable.

String


$.setenv(envname, value)

Sets the value of the specified environment variable, if no such variable is defined.

ParameterTypeDescription
envnameStringThe name of the environment variable.
valueStringThe new value, a string.

Nothing


$.sleep(milliseconds)

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.

ParameterTypeDescription
millisecondsNumberThe number of milliseconds to wait.

Nothing


$.write(text[, text...]...)

Writes the specified text to the JavaScript Console.

ParameterTypeDescription
textStringOne or more strings to write, which are concatenated to form a single string.

Nothing


$.writeln (text[, text...]...)

Writes the specified text to the JavaScript Console and appends a linefeed sequence.

ParameterTypeDescription
textStringOne or more strings to write, which are concatenated to form a single string.

Nothing