Logic Block

From VoxCommando
Jump to: navigation, search
Logic block.png

The logic block gives us access to an if-then-else type of functionality.

There are different types of logic that can be evaluated, but each will either be true or false. If true, the actions in the Then section will be executed. Otherwise, the actions in the Else section will be executed. Clicking the "not" checkbox effectively reverses the Then and the Else.

See the parameter helper for help with the syntax of standard variables that may be useful in your logic block.

Types of Blocks

Select the type of evaluation you want to perform using the dropdown field.

LastActionSuccess

Evaluates to 'true' if the previous action completed without error. No parameters required.

ProcessRunning

Takes one process name as a parameter (e.g. Notepad). Evaluates to 'true' if it is running. (See Processes.)

ProgramFocused

Takes one process name as a parameter (e.g. Notepad). Evaluates to 'true' if it is running and currently focused.

NB: Windows that appear in front of all others do not necessarily have focus--thanks Microsoft.

(A)==(B)

Takes two parameters. Evaluates to 'true' if they are the same.

(A)<(B)

Takes two parameters. Evaluates to 'true' if the first parameter's value is less than the second parameter's value.

This type of logic block obviously requires parameters that return numerical values. If either of the parameters cannot be interpreted by VC as a number, the outcome will evaluate to 'false'.

(A)Contains(B)

Takes two parameters. This is usually used to evaluate strings. Evaluates to 'true' if the text of parameter B appears in (is a substring of) the text of parameter A.

Note that this is case sensitive.

Doing Things Based on the Results

The Then and Else sections of the block can each contain multiple actions. Simply click on the button Gearplus.png to add more actions.

If you wish to terminate the entire macro based on the results of an evaluation, you can use the action VC.StopMacro.

Note: You can have a logic block that only uses a Then statement, without an Else. Just delete the default Else action field, or leave it blank.

More Complex Logic

If you have some programming experience and are looking to implement more complex logic, we recommend you use the Python plugin.