autoITkinect Posted February 11, 2011 Share Posted February 11, 2011 hi all of autoIT developer is there any function to hold down a key? i want to hold down left direction key until i hold down right key it will release the left key? i use it to make a controller for racing game. thanks a lot before Link to comment Share on other sites More sharing options...
Rogue5099 Posted February 11, 2011 Share Posted February 11, 2011 (edited) HotKeySet("l", "HoldLeftKey") ;Can't use {LEFT} for some reason? HotKeySet("{ESC}", "_Exit") While 1 Sleep(100) WEnd Func HoldLeftKey() While 1 Send("{LEFT}") Sleep(100) If _IsPressed(27) Then ExitLoop WEnd EndFunc Func _IsPressed($sHexKey, $vDLL = 'user32.dll') Local $a_R = DllCall($vDLL, "short", "GetAsyncKeyState", "int", '0x' & $sHexKey) If @error Then Return SetError(@error, @extended, False) Return BitAND($a_R[0], 0x8000) <> 0 EndFunc Func _Exit() Exit EndFunc Edited February 11, 2011 by rogue5099 My projects: Inventory / Mp3 Inventory, Computer Stats Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now