Commands & Syntax > Commands > Macro Flow Control >

www.perfectkeyboard.com

 

If KEY / MOUSE BUTTON - < if_key >() ... [Pro]

 

If KEY / MOUSE BUTTON
<if_key>("Identifier","State")
Available in: Professional edition

This command is used to determine whether a keyboard key (mouse button) is pressed or not.

 

#

Parameter name

Parameter description

1

Identifier

a,b,c,d, etc. key or a special key syntax like , , etc or KC:XXX (key code, for example KC:27). The KC:XXX is a key code number of a key on keyboard. The KC:XXX is showing in the main window in lower right area as keys are being hit. This way the user can know what is key code of each keyboard key.

As for the mouse buttons, one of the following identifier can be used:
- left mouse button
- middle mouse button
- right mouse button

2

State

Can be either DOWN or UP

 

Example (Macro Steps):

 

1

<#> <#> If-keys command example

2

Macro execution: ONLY COMMANDS

3

Message SHOW "" : "Press 'F12' key to continue..." (other parameters: x = -100, y = -100, Window title = Message, Buttons = None, Timeout (seconds) = , Always on top = ).

4

Keyboard BLOCK

5

Jump TARGET "loop"

6

If KEY / MOUSE BUTTON "" is "Down" then execute following steps

7

Macro EXIT

8

ENDIF

9

Jump TO "loop"

Example (Plain Text):

 

<#> If-keys command example

<cmds>

<msg>(-100,-100,"Press 'F12' key to continue...","Message",0)

<keys_block>

<label>("loop")

<if_key>("<F12>","DOWN")

<exitmacro>

<endif>

<goto>("loop")