Simulation of user input and support for system-wide hotkeys
package require twapi
This package provides procedures related to user input on Windows platforms. The commands send_input, send_keys, send_input_text, move_mouse, click_mouse_button and turn_mouse_wheel can be used to simulate user input. The mouse position can be retrieved using get_mouse_location. The commands block_input and unblock_input can be used to prevent interference from real user input while simulating input.
The commands register_hotkey and unregister_hotkey can be used to register scripts to be invoked when the user presses a hotkey combination.
| key | Specifies a virtual key being pressed and released. This is a more convenient form of specifying consecutive keydown, keyup events. VK should be an integer in the range 1-254 and specifies the virtual key. SCANCODE specifies a hardware scancode for the key. If -usescan is specified in keyopts, the specified scan code is used and VK will be ignored by the system. If -extended is specified in keyopts, the key is treated as an extended key with the scan code being preceded by a byte that has value 0xE0. |
| keydown | Specifies a virtual key being pressed. VK should be an integer in the range 1-254 and specifies the virtual key. SCANCODE specifies a hardware scancode for the key. keyopts may have the same values as specified for vkey. |
| keyup | Specifies a virtual key being released. VK should be an integer in the range 1-254 and specifies the virtual key. SCANCODE specifies a hardware scancode for the key. keyopts may have the same values as specified for vkey. |
| unicode | Specifies a unicode character. SCANCODE should contain the integer corresponding to the unicode character. VK and any keyopts are ignored if specified. |
| -relative | Indicates that XPOS and YPOS should be treated as relative to the last reported position, and not as absolute coordinates. |
| -ldown | Indicates that the left mouse button has been pressed since the last reported event. |
| -lup | Indicates that the left mouse button has been released since the last reported event. |
| -rdown | Indicates that the right mouse button has been pressed since the last reported event. |
| -rup | Indicates that the right mouse button has been released since the last reported event. |
| -mdown | Indicates that the middle mouse button has been pressed since the last reported event. |
| -mup | Indicates that the middle mouse button has been released since the last reported event. |
| -x1down | Indicates that the first X button has been pressed since the last reported event. |
| -x1up | Indicates that the first X button has been released since the last reported event. |
| -x2down | Indicates that the second X button has been pressed since the last reported event. |
| -x2up | Indicates that the second X button has been released since the last reported event. |
| -moved | Indicates that the mouse has moved since the last reported event. |
| -wheel WHEELUNITS | Indicates that the mouse wheel was rotated by WHEELUNITS. This may be a positive integer for forward rotation, or a negative integer for backward rotation. This option may not be used with any of the X button options. |
| {BACKSPACE} | Backspace |
| {BACK} | (same as {BACKSPACE}) |
| {BS} | (same as {BACKSPACE}) |
| {BKSP} | (same as {BACKSPACE}) |
| {TAB} | Tab |
| {CLEAR} | |
| {ENTER} | Enter key on the main keyboard |
| {RETURN} | (same as {ENTER}) |
| {SHIFT} | Shift (see note below on difference between this and use of the + modifier). |
| {CONTROL} | Shift (see note below on difference between this and use of the ^ modifier). |
| {ALT} | Shift (see note below on difference between this and use of the % modifier). |
| {MENU} | (same as {ALT}) |
| {PAUSE} | Pause |
| {BREAK} | Break |
| {CAPSLOCK} | Caps Lock |
| {CAPITAL} | (same as {CAPSLOCK}) |
| {KANA} | |
| {HANGEUL} | |
| {HANGUL} | |
| {JUNJA} | |
| {FINAL} | |
| {HANJA} | |
| {KANJI} | |
| {ESCAPE} | Escape |
| {ESC} | (same as {ESCAPE}) |
| {CONVERT} | |
| {NONCONVERT} | |
| {ACCEPT} | |
| {MODECHANGE} | |
| {SPACE} | Spacebar |
| {PGUP} | Page Up |
| {PRIOR} | (same as {PGUP}) |
| {PGDN} | Page Down |
| {NEXT} | (same as {PGDN}) |
| {END} | End |
| {HOME} | Home |
| {LEFT} | Left arrow |
| {UP} | Up arrow |
| {RIGHT} | Right arrow |
| {DOWN} | Down arrow |
| {SELECT} | |
| {PRTSC} | Print Screen key |
| {PRINT} | Print key |
| {EXECUTE} | |
| {SNAPSHOT} | |
| {INSERT} | Insert |
| {INS} | (same as {INSERT}) |
| {DELETE} | Delete |
| {DEL} | (same as {DELETE}) |
| {HELP} | Help |
| {LWIN} | Left Windows key |
| {RWIN} | Right Windows key |
| {APPS} | |
| {SLEEP} | |
| {NUMPAD0} | Numeric keypad 0 |
| {NUMPAD1} | Numeric keypad 1 |
| {NUMPAD2} | Numeric keypad 2 |
| {NUMPAD3} | Numeric keypad 3 |
| {NUMPAD4} | Numeric keypad 4 |
| {NUMPAD5} | Numeric keypad 5 |
| {NUMPAD6} | Numeric keypad 6 |
| {NUMPAD7} | Numeric keypad 7 |
| {NUMPAD8} | Numeric keypad 8 |
| {NUMPAD9} | Numeric keypad 9 |
| {MULTIPLY} | Numeric keypad * |
| {ADD} | Numeric keypad + |
| {SEPARATOR} | |
| {SUBTRACT} | Numeric keypad - |
| {DECIMAL} | Numeric keypad . |
| {DIVIDE} | Numeric keypad / |
| {F1} | Function key F1 |
| {F2} | Function key F2 |
| {F3} | Function key F3 |
| {F4} | Function key F4 |
| {F5} | Function key F5 |
| {F6} | Function key F6 |
| {F7} | Function key F7 |
| {F8} | Function key F8 |
| {F9} | Function key F9 |
| {F10} | Function key F10 |
| {F11} | Function key F11 |
| {F12} | Function key F12 |
| {F13} | Function key F13 |
| {F14} | Function key F14 |
| {F15} | Function key F15 |
| {F16} | Function key F16 |
| {F17} | Function key F17 |
| {F18} | Function key F18 |
| {F19} | Function key F19 |
| {F20} | Function key F20 |
| {F21} | Function key F21 |
| {F22} | Function key F22 |
| {F23} | Function key F23 |
| {F24} | Function key F24 |
| {NUMLOCK} | Numlock |
| {SCROLL} | Scroll lock |
| {SCROLLLOCK} | Scroll lock |
| {LSHIFT} | Left Shift |
| {RSHIFT} | Right Shift |
| {LCONTROL} | Left Control |
| {RCONTROL} | Right Control |
| {LALT} | Left Alt |
| {LMENU} | (same as {LALT}) |
| {RALT} | Right Alt |
| {RMENU} | (same as {RALT}) |
| {BROWSER_BACK} | Back |
| {BROWSER_FORWARD} | Forward |
| {BROWSER_REFRESH} | |
| {BROWSER_STOP} | Stop |
| {BROWSER_SEARCH} | Search |
| {BROWSER_FAVORITES} | Favorites |
| {BROWSER_HOME} | Web Home |
| {VOLUME_MUTE} | |
| {VOLUME_DOWN} | |
| {VOLUME_UP} | |
| {MEDIA_NEXT_TRACK} | |
| {MEDIA_PREV_TRACK} | |
| {MEDIA_STOP} | |
| {MEDIA_PLAY_PAUSE} | |
| {LAUNCH_MAIL} | |
| {LAUNCH_MEDIA_SELECT} | |
| {LAUNCH_APP1} | |
| {LAUNCH_APP2} |
Copyright © 2003, 2004, Ashok P. Nadkarni