Hot Keyboard

macros for Windows

Automate Windows with macros
Main Download Purchase Support

2.17 Evaluate Expression

<< Previous | Table Of Contents | Next >>

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:

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:
  1. Pastes<ID>
  2. Increments $startid
  3. modvar_macro_3.gif
  4. 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:"))
returns cosine of entered value.

In Evaluate Expression macro you can use GoTo function, thus making loops, for example:

SetVar($msg, InputBox("Enter Email"))
iif ( (StrFind ($msg, "@") < 0), ( GoTo "label" ), (1) )

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:

<< Previous | Table Of Contents | Next >>

  © 1998-2016 Imposant