uCon HomePage

Script Command: SENDINPUT



SENDINPUT 
[-AbCd:f:mMSv] {character(s) to send}

This command is a wrapper to provide script-level access to the SendInput() function in Windows. In the nutshell, this allows the user to simulate keyboard (Virtual Keys) input to other applications (whichever application is in the foreground).

Options: 
-A                                                      invoke characters with ALT key depressed *
-b                                                       move current foreground window to the back
-C                                                      invoke characters with CTRL key depressed *
-d ###                                               delay in milliseconds prior to making sendinput() call.
-f  {[classname,]windowname}       bring application the foreground using FindWindow(classname,windowname) to retrieve the handle.
-m                                                      minimize current foreground window
-M                                                      maximize current foreground  window
-S                                                       invoke characters with SHIFT key depressed *
-v                                                       use low byte of VkKeyScan(ch) for each character

* not heavily tested

Notes:
If 'classname' is NULL it finds any window whose title matches the 'windowname' parameter.
If 'windowname' is NULL, all window names match.

Examples:

 # Send Left-arrow key to whichever application is currently in the foreground
SENDINPUT   \x25                               

# Bring "Programmer's Notepad - [<new>]" to the foreground and send 12345
SENDINPUT -f "NULL,Programmer's Notepad - [<new>]"  12345  

 # Bring "Programmer's Notepad - [<new>]" to the foreground, delay for 2 seconds and send 12345
SENDINPUT -d 2000 -f "NULL,Programmer's Notepad - [<new>]"  12345    

 # Same as above, but we can omit the leading "NULL," it will be implied...
SENDINPUT -d 2000 -f "Programmer's Notepad - [<new>]"  12345      

Some virtual keys:  
(refer to MSDN documentation on 'Virtual Key Codes' for full list)

PgUp 0x21
PgDwn 0x22
End 0x23
Home 0x24
Left Arrow 0x25
Up Arrow 0x26
Right Arrow 0x27
Down Arrow 0x28
PrintScrn0x2c
Numpad 0-9 0x60-0x69
FunctionKeys  F1-F24 0x70-0x87