Evaluate Expression
With this macro, you can modify value of a variable.
Let's start with an example: we need to generate links to add them into e-mail messages on a regular basis:
http://www.myshop.com?item=123 http://www.myshop.com?item=124 http://www.myshop.com?item=125 http://www.myshop.com?item=126 http://www.myshop.com?item=127
The problem is that each time the first ID is different and should be defined manually.
Here's the solution
It contains two Evaluate Expression macros. The first one asks for the new start id and saves it to $startid variable.
Then the loop Links starts, which does the following:- Pastes http://www.myshop.com?item=<ID>
- Increments $startid
- Delays for 0.2 seconds (to make sure destination application accepts the text insertion)
Action Parameters:
Expression to evaluate - you can put here scripting functions, the whole expression returns the value of the last function or operator. For example:
SetVar($myvar, InputBox("Enter variable:")) cos($myvar)returns cosine of entered value.
In Evaluate Expression macro you can use GoTo function, thus making loops, for example:
label: SetVar($msg, InputBox("Enter Email")) iif ( (StrFind ($msg, "@") < 0), ( GoTo "label" ), (1) ) MessageBox($msg)
The code above will ask you for the text string unless it contains "@" char.
Iteration limit - limits the number of GoTo jumps while evaluating the expression in order to avoid infinite loop
See also: