Skip to main content

NightWatchman Enterprise 7.3

The NightWatchman script helper reference

Method and property categories

This section details the methods that are available in the NightWatchman NWMScriptHelper.ocx. These methods are available for use within a power-off script once an instance of the NWMScriptHelper is created. To do this, call the following code from within your script:

WScript.CreateObject("NWMSCRIPT.NWMScriptHelperCtrl.2")
Application methods

These methods provide access to currently running applications.

  • ActivateApp – activates the specified application window.

  • CloseActiveAppDialogs – closes active dialogs in the specified application.

  • CloseActiveAppDialogsLike – closes active dialogs, like the specified class, the specified application may have open, by selecting the Cancel and Close buttons.

  • GetActiveObject – creates an application object for an application with an application scripting class.

Window methods

These methods allow you to retrieve and set properties for windows open in the currently running application, refer to NightWatchman helper APIs for details.

  • ExpectWindow – waits for a window matching the specified search string or title.

  • FindInvisibleWindowLike – allows you to specify a search string to find an application window that is hidden. This is similar to the Windows API FindWindow except that it can use regular expressions for the search strings.

  • FindWindowLike – finds a window using a specified search string.

  • GetAccItem – retrieves the value of a specified item in the active window.

  • GetWindowText – gets the title of the specified window.

  • SelectAccItem – makes the specified item active.

  • SelectSubItem > – selects the specified sub item in the active window.

  • SetActiveWindow – makes the specified window active.

  • WaitForWindow – waits for the specified window to be created.

  • WaitWindowGone – waits for the specified window to close.

  • ClickButton – performs the action of the mouse clicking the specified dialog button.

  • ClickMouse – performs the action of clicking the specified mouse button.

  • SendKeys – sends keystrokes to the "Top Window" of the active application.

  • SendKeysToWindow – sends keystrokes the "Top Window" of the application containing the specified Window

  • SendKeysToDialog – sends Keystrokes to the specified window

Save file environment methods

These methods enable aspects of the applications open file environment to be utilized within the power-off script.

  • GetCmdLine – gets the command line path for the running application.

  • GetCurrDir – returns the current directory for the running application.

  • GetEnvVar – returns the value for the specified environment variable.

File methods

These methods provide file specific functionality.

  • CopyFile – copies a file to a specified location.

  • GetFullPath – gets the full path for the specified file.

  • MakeNWMFilename – creates a filename for a NightWatchman saved file.

  • MoveFile – moves a file to a specified location.

NightWatchman methods and properties

This method defines an interface for interacting with NightWatchman.

Methods
  • WriteToBackupList – outputs the name of a backed-up file to the log file so it can be viewed by the user from the NightWatchman Backup dialog.

Properties
  • PowerdownAction – this property allows you to query the power down action from within the script so that you can choose different execution paths based on the final state of the machine

Script methods and properties

The following properties and methods define settings for controlling and debugging the NightWatchman scripts.

Methods
  • Log – outputs a string to the scripts log file.

  • BackupDirectory – returns the user specific backup directory determined by NightWatchman.

    Note

    The BackupDirectory is fixed so that files backed up are saved to the logged on user's profile.

Properties

Refer to NightWatchman scripting properties for the following properties.

  • debug – specifies the level of debugging output to the log file.

  • LogFileName – sets the location of the scripts log file.

  • TimeoutSecs – sets the timeout for wait operations.