JScript Application

From RealWorld Wiki

Jump to: navigation, search
RealWorld scripting reference

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

[edit] 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 factory. The factory is identified by its GUID.
  • object CreateDocument(string wizardID, int index, bool interactive) - 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).

[edit] Example

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