Commands & Syntax > Commands > Macro Flow Control >

IF NUMERIC - < if_num >() ... [Pro]

www.perfectkeyboard.com

 

IF NUMERIC
<if_num>("expression")
Available in: Professional edition

The command evaluates a numeric expression and if it is evaluated as "true" then following macro steps (steps between "if" and "else/endif") are executed. The expression can NOT contain EXPR(...) syntax.

 

#

Parameter name

Parameter description

1

expression

Expression can contain brackets () and these operators are available:
== (is equal)
!= (is not equal)
<= (is smalller or equal)
< (is smaller)
>= (is bigger or equal)
> (is bigger)
_AND_ (the condition is true AND also following condition is true)
_OR_ (the condition is tru OR the following condition is true)

Expression examples:
%Var1%==%Var2%
100<%vNum%+10
(%x%>%y%) _OR_ (%x%+10<%y%)

 

Example (Macro Steps):

 

1

<#> <#> This example shows how to use "if" command.

2

Macro execution: ONLY COMMANDS

3

Variable SET "vNum=", Message text="Type a number:"

4

IF NUMERIC 100<(30+%vNum%)

5

Message SHOW "Information" : "Yes, this is true: 100<30+%vNum%" (other parameters: x = -100, y = -100, Window title = Message, Buttons = OK, Timeout (seconds) = , Always on top = ).

6

ELSE activate

7

Message SHOW "Error" : "No, it is not true: 100<30+%vNum%" (other parameters: x = -100, y = -100, Window title = Message, Buttons = OK, Timeout (seconds) = , Always on top = ).

8

ENDIF

Example (Plain Text):

 

<#> This example shows how to use "if" command.

<#>

<cmds>

<varset>("vNum=","Type a number:")

<if_num>("100<(30+%vNum%)")

<msg>(-100,-100,"Yes, this is true: 100<30+%vNum%","Message",1,,0)

<else>

<msg>(-100,-100,"No, it is not true: 100<30+%vNum%","Message",1,,2)

<endif>