JScript Application

Log-in or register.

JScript Application

Application is a global object accessible in the JScript document operation.

Methods and properties

  • string Name (get) - returns name of the running application (for example "RealWorld Photos").
  • string Version (get) - returns version as string (for example "2007.1").
  • int LocaleID (get) - language identifier set by the user. Can be used to localize for example the content of a message box.
  • string Clipboard (get/set) - put or get a text from the clipboard.
  • bool MessageBox(string text, string caption, bool question) - displays a message box. If question is true then the function returns true if user clicked the Yes button.
  • string FileDialog(string initialPath, string caption, bool fileMustExist) - displays a dialog with file browser. If fileMustExist is true, the dialog servers for opening files, if it is false, the dialog acts as a file save dialog. If the user picks a file, it is returned. If error occurs or use cancels the operation, null is returned.
  • object OpenDocument(string path) - returns an document if successful or null otherwise. The operation may fail because the path is invalid, document type is not recognized or due to internal error.
  • object OpenDocumentAs(string path, string factoryID) - similar to OpenDocument function, but only uses the specified document builder. The builder is identified by its GUID. This method is useful in cases where it is possible to open a file using different document builders. For example a .jpg image may be opened as a raster image (35AFBDB5-1B26-4195-8786-83C8E1CBC08E), a layered image (75E2E54E-C275-42EC-8A63-04A487C8E328) or an animation (1DD0CAA1-B18F-4979-9E3E-3077FE5821CB).
  • object CreateDocument(string wizardID, int index, bool interactive) - deprecated (removed from version 2010.1) - create a new document using the specified wizard and index. Only non-interactive wizards can be used if interactive is false. Refer to the documentation of the individual wizard plug-ins to learn which one are compatible with script.
  • void OpenWindow(object document) - open document in new application window (if the application in question supports windows).

new in version 2009.1:

  • double GetCreatedTime(string path) - returns creation time of a file identified by the path parameter in milliseconds since 1970 - the number can be used directly with the setTime method of the JavaScript Date object.
  • string Translate(string eng) - attempts to translate string from English to a language currently selected in the application. Returns the original string if translation is not available.

new in version 2010.1:

  • object CreateWizard(string wizardID) - creates a configuration object that can be used to change wizard parameters like the Javascript Operation object's Configuration.
  • object CreateDocument(object configuration) - create a new document using the specified wizard. User interface might be shown if the wizard requires it, for example Icon from Image wizard asks for an image file. Refer to the documentation of the individual wizard plug-ins to learn which ones are compatible with scripting.

new in version 2012.1:

  • int GetFileSize(string path) - returns the size of the specified file in bytes or 0 if the file does not exist.

Example

// display a message box
Application.MessageBox(
    "You are using version "+Application.Version+" of "+
    Application.Name+".", "Useless information", false);

Recent comments

user icon Anonymous on November 4th 2013

Ok, I'm a major n00b. How do I execute a script???

user icon Anonymous
What about ICL files?
Vista & Win 7 icons