Commands & Syntax > Commands > Keyboard >

www.perfectkeyboard.com

 

SEND KEYSTROKES - < keystrokes >() ... [Pro]

 

Keyboard SEND KEYSTROKES
<keystrokes>("Keystrokes sequence","Delay (ms)","Keystrokes per delay")
Available in: Professional edition

The command sends defined sequence of keystrokes to the currently active window. The command allows to control the speed of the keystrokes by specifying two additional parameters. If they are set to 5 and 25 then the meaning is "delay sending of keystrokes for 5 milliseconds after each 25 keystrokes are sent".

 

#

Parameter name

Parameter description

1

Keystrokes sequence

The key to press/release such as a, b, 1, /, etc. For Shift, Ctrl, F1, etc., keys <shift>, <ctrl>, <F1> syntax needs to be used.

2

Delay (ms)

Time in milliseconds to wait after "keystrokes per delay" were executed.

3

Keystrokes per delay

Number of keystrokes to send before delay takes place.

 

Example (Macro Steps):

 

1

<#> <#> This sample slowly types 'Hello!' to Notepad (if it is open)

2

Macro execution: ONLY COMMANDS

3

IF WINDOW "[* - Notepad|Notepad|#46|#118]" Is Open (Match=Partial)

4

Window ACTIVATE bring "[* - Notepad|Notepad|#46|#118]" window to top (other parameters: Match = Partial, Window state = Normal, %p4_name = )

5

Keyboard SEND KEYSTROKES "Hello!", Delay (ms)="500"

6

ELSE activate

7

Message SHOW "" : "'Notepad' is not opened!" (other parameters: x = 100, y = 100, Window title = Message, Buttons = OK, Timeout (seconds) = , Always on top = ).

8

ENDIF

Example (Plain Text):

 

<#> This sample slowly types 'Hello!' to Notepad (if it is open)

<cmds>

 

<if_win>("[* - Notepad|Notepad|#46|#118]","OPEN",0)

   <actwin>("[* - Notepad|Notepad|#46|#118]",0,0)

   <keystrokes>("Hello!","500","5")

<else>

   <msg>(100,100,"'Notepad' is not opened!","Message",1)

<endif>