This action allows to calculate an expression value and then save it into a variable. The expression has to be written according to the syntax of JS language. The documentation for the language can be read on the Microsoft site: http://msdn.microsoft.com/en-us/library/t0aew7h6(v=vs.84).aspx
The action also allows to connect the function library from an external file or directly in an additional script.
For example, try to calculate the expression
sum(5,6) + multi(3,4)
And we get the error. The VB Script language doesn't contain functions sum and multi.
To solve this, it is possible to specify a little library of user functions:
function sum(a, b)
sum = a + b
function multi(a, b)
multi = a * b
In this case the action calculates the result without any troubles. The given example is too simple and is cited for the demonstration solely.
if a > 30 then
'this is synthetic limitation
err.raise 1, , "Parameter more than 30"
res = 1
for i = 1 to a
res = res * i
factorial = res
Now we easy can calculate the expression:
Given possibility allows to do some specific calculations, that are difficult to be written in one line.
Expression To Evaluate
Write down the expression whose value needs to be calculated. The expression has to be made according to the syntax of VB Script.
Assign Result to Variable
Enter the name of the variable into which it is necessary to save the result.
Load VB Script from File
Load the library of additional functions from an external file. Enter a file name or choose it interactively.
The file name can be empty. In this case the action works only with standard functions and objects of VB Script.
Use Internal Script
If you want to specify functions directly in a task, choose this option. To edit a script, click the button Edit Script. You can see the editor like in the action VB Script.
The text of a script can be empty. In this case the action works only with standard functions and objects of VB Script.