1. Home
  2. Docs
  3. Scense Embedded Scripting...
  4. Scense Language Extension...
  5. Functions



RaiseError Function

This function will generate a runtime error with the specified error description.
The script will be aborted and the error will show up in the Scense Log

RaiseError "Something went wrong"


ReplaceVariables Function

This function will take a string containing variables, and returns a string value containing the input string with all variables replaced by their actual values.

s1 = ReplaceVariables("Processor architecture: %PROCESSOR_ARCHITECTURE%")

After execution, the ‘s1’-variable might contain: “Processor architecture: x86“
See the Scense Administrator Guide for all supported Scense Variables.

ScenseExecute Function

The ScenseExecute function makes it possible to execute Scense Client tasks from a script.
This function currently support these commands


Command Description
RebuildShortcuts Scense Client equivalent: Restore startmenu shortcuts
ReconnectNetwork Scense Client equivalent: Restore network drive mappings
RebuildFiletypes Scense Client equivalent: Restore Filetype Associations
ReconnectPrinters Restore network printer mappings
ExecuteTaskset Start a specific TaskSet identified by symbolic name.
This command requires 2 parameters:
TaskSet symbolic name as specified in the TaskSet property page
Session Event name as specified in the Session Event property page


ScenseExecute "RebuildShortcuts"
ScenseExecute "ExecuteTaskset", "Orca", "Install Application"

This function will return a Boolean value of ‘False’ if an unsupported command is issued.

Wait Function

The Wait function will pause the script execution for the specified number of seconds. The thread will not be suspended while waiting.
The script below will write timestamps into the Scense Executive log with an interval of 10 seconds

Sub Scense_Main()
    WriteScenseLog Now
    Wait 10
    WriteScenseLog Now
End Sub

This will result in the Executive log below.

Time Elapsed Item Description Source
14:31:21 0,004 System 25-1-2007 14:31:21 Scense Scripting
14:31:31 10,003 System 25-1-2007 14:31:31 Scense Scripting


WriteScenseLog Function

Scense administrators use the Scense Executive Log to what exactly happened for a specific user on a computer.
The WriteScenseLog method enables writing into the sessions’ executive log from the script.

WriteScenseLog "Some text to be displayed in the Scense log"

An optional Boolean parameter can be added to the function to make the message show up as an error in the Scense log.

WriteScenseLog "Something went wrong", True