The VBScript Action executes VBScript code authored by the user. This is an advanced Action designed for experienced VBScript programmers. Authoring and debugging VBScript code is the responsibility of the user.
Select Advanced Actions to expand the Action list. Select the VBScript Action from the Actions list to display the Action Builder. Specify where you would like to run the VBScript from. The Script can either be Embedded within Foxtrot, or, it may reference an External file.
The following functions are available through VBScript:
Function |
Description |
RPAEngine.ClearStatus |
Clears the text in the status bar. |
RPAEngine.GetVar |
Retrieves the value of the specified variable. |
RPAEngine.SetStatus |
Displays the specified text in the status bar. |
RPAEngine.SetVar |
Sets the value of the specified variable. |
RPAEngine.StopTask |
Immediately stops the running task. |
RPAEngine.ClearStatus
The RPAEngine.ClearStatus method clears the text displayed in the status bar.
Syntax:
RPAEngine.ClearStatus() |
Example:
Call RPAEngine.ClearStatus() |
RPAEngine.GetVar
The RPAEngine.GetVar function retrieves the value of the specified variable.
Syntax:
RPAEngine.GetVar( _ ByVal strVariableName As String, _ ByRef strValue As String) As Boolean |
Parameters:
- strVariableName: [in] The name of the variable containing the value to retrieve.
- strValue: [out] The value retrieved from the variable.
Return Value:
- The function returns True if the value was successfully retrieved from the variable.
- The function returns False if the value could not be retrieved from the variable.
Remarks:
- If the function call fails, make sure a variable exists with the name you specified.
Example:
The code below retrieves the value from a variable named VariableA, stores it in a variable named strValue, then displays it in a message box.
Dim strValue If RPAEngine.GetVar("VariableA", strValue) = True Then Msgbox strValue, vbInformation, "Result" Else Msgbox "The value could not be retrieved.", vbCritical, "Result" End If |
RPAEngine.SetStatus
The RPAEngine.SetStatus method sets the text to be displayed in the status bar.
Syntax:
RPAEngine.SetStatus( _ ByVal strStatusText As String) |
Parameters:
- strStatusText: The text to display in the Foxtrot status bar.
Return Value:
- None
Remarks:
- The text will appear in the status bar until either (a) the end of the VBScript Action code is reached, or (b) the RPAEngine.ClearStatus method is called.
Example:
The code below displays "Please wait..." in the status bar.
Call RPAEngine.SetStatus("Please wait...") |
RPAEngine.SetVar
The RPAEngine.SetVariableValue function sets the value of the specified variable.
Syntax:
RPAEngine.SetVar( _ ByVal strVariableName As String, _ ByVal strValue As String) As Boolean |
Parameters:
- strVariableName: [in] The name of the variable whose value will be set.
- strValue: [in] The value to store in the variable.
Return Value:
- The function returns True if the value was successfully retrieved from the variable.
- The function returns False if the value could not be retrieved from the variable.
Remarks:
- If the function call fails, make sure a variable exists with the name you specified.
Example:
The code below sets the value of a variable named VariableA to "NewValue".
If RPAEngine.SetVar("VariableA", "NewValue") = True Then Msgbox "Success", vbInformation, "Result" Else Msgbox "The value could not be set.", vbCritical, "Result" End If |
RPAEngine.StopTask
The RPAEngine.StopTask method immediately stops the running task.
Syntax:
RPAEngine.StopTask( _ Optional ByVal lngMessageType As Long = 0, _ Optional ByVal strMessage As String = "", _ Optional ByVal strTitle As String = "", _ Optional ByVal Style As VbMsgBoxStyle = vbExclamation) |
Parameters:
- lngMessageType: [in, optional] The type of message to display when the script stops. This parameter must contain one of the following values:
|
- strMessage: [in, optional] The message to display in the message box. This parameter is used only when the lngMessageType parameter is set to 1.
- strTitle: [in, optional] The message box title. This parameter is used only when the lngMessageType parameter is set to 1.
- Style: [in, optional] The message box style. This parameter is used only when the lngMessageType parameter is set to 1.
|
Return Value:
- None.
Remarks:
- The default message reads: "The script has been stopped."
- The default title reads: "Foxtrot"
Example 1: The code below stops the script and displays the default stop message.
Call RPAEngine.StopTask(0) |
Example 2: The code below stops the script and displays the default stop message.
Call RPAEngine.StopTask(1, "My message here.", "My Title", vbExclamation) |
Example 3: The code below stops the script and displays the default stop message.
Call RPAEngine.StopTask(2) |
Comments
0 comments
Please sign in to leave a comment.