Skip to content

window-class

Window class

The Window class defines these static properties and functions. Window instances created with new Window() do not have these properties and functions defined.


Window Class Attributes

Window.frameworkName

Window.frameworkName

Description

Type

String


Window.version

Window.version

Description

Type

String


Window Class Methods

Access these function through the class. For example:

Window.alert("Notification to user");

alert()

Window.alert(message[, title="Script Alert", errorIcon=false]);

Description

Displays a platform-standard dialog containing a short message and an OK button.

Parameters

ParameterTypeDescription
messageStringThe string for the displayed message.
titleStringOptional. A string to appear as the title of the dialog, if the platform supports a title. Mac OS does not support titles for alert dialogs. The default title string is "Script Alert"
errorIconBooleanOptional. When true, the platform-standard alert icon is replaced by the platform-standard error icon in the dialog. Default is false.

Returns

Nothing


confirm()

Window.confirm(message[, noAsDflt=false, title="Script Alert"]);

Description

Displays a platform-standard dialog containing a short message and two buttons labeled “Yes” and “No”.

Parameters

ParameterTypeDescription
messageStringThe string for the displayed message.
noAsDfltBooleanOptional. When true, the No button is the default choice, selected when the user types ENTER. Default is false, meaning that Yes is the default choice.
titleStringOptional. A string to appear as the title of the dialog, if the platform supports a title. Mac OS does not support titles for confirmation dialogs. The default title string is "Script Alert"

Returns

Boolean. true if the user clicked “Yes”, false if the user clicked “No”.


find()

Window.find(resourceName)

Window.find(type, title)

Description

Use this method to find an existing window. This includes windows already created by a script, and windows created by the application (if the application supports this case).

Not supported in all ScriptUI implementations.

Parameters

ParameterTypeDescription
resourceNameStringThe name of a predefined resource available to JavaScript in the current application.
typeStringOptional. The window type (see Window object constructor) used if there is more than one window with the same title. Can be null or the empty string.
titleStrignThe window title.

Returns

Window object found or generated from the resource, or null if no such window or resource exists.


prompt()

Window.prompt(message, preset[, title="Script Prompt"]);

Description

Displays a modal dialog that returns the user’s text input.

Parameters

ParameterTypeDescription
messageStringThe string for the displayed message.
presetStringThe initial value to be displayed in the text edit field.
titleStringOptional. A string to appear as the title of the dialog. In Windows, this appears in the window’s frame; in Mac OS it appears above the message. The default title string is "Script Prompt".

Returns

Returns the value of the text edit field if the user clicked OK, null if the user clicked Cancel.