getCurrentScript

The getCurrentScript function allows retrieving the BrowserObject that represents the current script.

Syntax

var user = getCurrentScript();

 

Result

Error Handling

Errors can occur in case:

  • The user executing the script has no access to the current script object. The user executing the script can be the logged on user or a user whose credentials are being used to execute the script.

Examples of Use

 

How to write the Notes property of the current script

var executionInfo = getCurrentSystem().systemName + " - " + getCurrentUser() + " - " + new Date();

var currentScript = getCurrentScript();

if (currentScript.error != null) {

    console("Error: " + currentScript.error);

}

else {

    executePropertyCommand(currentScript, "Notes", "Change", executionInfo);

}