How To simulate keyboard strokes
This little program makes it possible to simulate keystrokes.
Task properties: Batch
EndTask: Yes/Before
We are using two variable
A and
B tomake it possible to simulate codes which exists of 2 keys (f.e. Alt+P)
A list of keycodes can be found at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/WindowsUserInterface/UserInput/VirtualKeyCodes.asp∞
Record Main:
Select Virtual i-Keynumber1 Numeric 3 (var A)
Select Virtual i-Keynumber2 Numeric 3 (var B)
Task Prefix:
Press the Key
Evaluate CallDLLS ('user32.keybd_event','22444',A,0,0,0)
Evaluate CallDLLS ('user32.keybd_event','22444',B,0,0,0)
Release the key
Evaluate CallDLLS ('user32.keybd_event','22444',B,0,2,0)
Evaluate CallDLLS ('user32.keybd_event','22444',A,0,2,0)
Example:
Caps Lock : A=20 B=0
Remarks
- An application can simulate a press of the PRINTSCRN key in order to obtain a screen snapshot and save it to the clipboard. To do this, call keybd_event with the bVk parameter set to VK_SNAPSHOT.
- Windows NT/2000/XP: The keybd_event function can toggle the NUM LOCK, CAPS LOCK, and SCROLL LOCK keys.
- Windows 95/98/Me: The keybd_event function can toggle only the CAPS LOCK and SCROLL LOCK keys. It cannot toggle the NUM LOCK key.
Category
CategoryHowTo
There are no comments on this page. [Add comment]