Keyboard Control!
Posted: Mon Jan 31, 2005 3:22 am
Code updated For 5.20+
this small example code shows how to press and release the keyboard like if you were entering it your self.
everything is basicly self-explanitory or in the comments have fun
this small example code shows how to press and release the keyboard like if you were entering it your self.
everything is basicly self-explanitory or in the comments have fun

Code: Select all
;Keyboard Control!
;by Dreglor
;1/30/05
;notes go here for a complete chart of keycodes
;http://msdn.microsoft.com/library/Default.asp?url=/library/en-us/winui/winui/WindowsUserInterface/UserInput/VirtualKeyCodes.asp
RunProgram("notepad");open notepad just to test it :)
Delay(100);wait for it to load up
keybd_event_(#VK_H,0,0,0);press H
keybd_event_(#VK_H,0,#KEYEVENTF_KEYUP,0);release H
keybd_event_(#VK_E,0,0,0);press E
keybd_event_(#VK_E,0,#KEYEVENTF_KEYUP,0);release E
keybd_event_(#VK_L,0,0,0);press L
keybd_event_(#VK_L,0,#KEYEVENTF_KEYUP,0);release L
keybd_event_(#VK_L,0,0,0);press L
keybd_event_(#VK_L,0,#KEYEVENTF_KEYUP,0);release L
keybd_event_(#VK_O,0,0,0);press O
keybd_event_(#VK_O,0,#KEYEVENTF_KEYUP,0);release O
;you should see notepad popup with the text "hello" in it if not try increasing the delay