Adobe InDesign CS5 (7.0) Object Model JS: $

InDesign CS5

Class

$

 The $ object provides a number of debugging facilities and informational methods.

QuickLinks

about, bp, colorPicker, evalFile, gc, getenv, setenv, sleep, toString, write, writeln

Class

PropertyTypeAccessDescription
buildstring readonlyThe ExtendScript build information.
buildDateDate readonlyThe ExtendScript build date.
decimalPointstring r/wThe character used as the decimal point character in formatted numeric output.
engineNamestring readonlyThe name of the current ExtendScript engine, if set.
errorError r/wThe most recent run-time error information.
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.
fileNamestring readonlyThe file name of the current script.
flagsnumber r/wGets or sets low-level debug output flags.
A logical AND of 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.
globalObject readonlyA reference to the global object, which contains the JavaScript global namespace.
hiresTimernumber readonly A high-resolution timer, measuring the time in microseconds. The timer starts when ExtendScript is initialized during the application startup sequence. Every read access resets the timer to Zero.
includePathstring readonlyThe path for include files for the current script.
levelnumber r/wThe current debugging level, which enables or disables the JavaScript debugger.
One of 0 (no debugging), 1 (break on runtime errors), or 2 (full debug mode).
linenumber readonlyThe current line number of the currently executing script.
localestring r/wGets 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 undefined, null, or the empty string.
localizebool r/wSet to true to enable the extended localization features of the built-in toString() method.
memCachenumber r/wThe ExtendScript memory cache size, in bytes.
osstring readonlyThe current operating system version information.
Example $.os
Result: Windows XP 5.1 Service Pack 2
screensArray of Object readonlyAn array of objects containing information about the display screens attached to your computer.
Each object has the properties left, top, right, bottom, which contain the four corners of each screen in global coordinates.A property primary is true if that object describes the primary display.
stackstring readonlyThe current stack trace.
strictany r/wSets or clears strict mode for object modification.
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.
versionstring readonlyThe version number of the ExtendScript engine.
Formatted as a three-part number and description; for example: "3.92.95 (debug)".

Methods

string about ()
Shows an About box for the ExtendScript component, and returns the text for the box.

void bp ([condition: any])
Breaks execution at the current position.

ParameterTypeDescription
condition any A string containing a JavaScript statement to be used as a condition. If the statement evaluates to true or nonzero when this point is reached, execution stops. (Optional)

number colorPicker (color: number)
Invokes the platform-specific color selection dialog, and returns the selected color.

ParameterTypeDescription
colornumberThe color to be preselected in the dialog, as 0xRRGGBB, or -1 for the platform default.

any evalFile (file: File[, timeout: number=10000])
Loads and evaluates a file.

ParameterTypeDescription
fileFileThe file to load.
timeoutnumberAn optional timeout in milliseconds. (default: 10000) (Optional)

void gc ()
Initiates garbage collection in the ExtendScript engine.

string getenv (name: string)
Retrieves the value of an environment variable.

ParameterTypeDescription
namestringThe name of the variable.

void setenv (name: string, value: string)
Sets the value of an environment variable.

ParameterTypeDescription
namestringThe name of the variable.
valuestringThe value of the variable.

void sleep (msecs: number)
Suspends the calling thread for a 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
msecsnumberNumber of milliseconds to sleep.

string toString ()
Converts this object to a string.

void write (text: any)
Prints text to the Console.

ParameterTypeDescription
text any The text to print. All arguments are concatenated.

void writeln (text: any)
Prints text to the Console, and adds a newline character.

ParameterTypeDescription
text any The text to print. All arguments are concatenated.

Jongware, 20-Jun-2010 v3.0.3dContents :: Index