lygersarereal Posted February 19, 2011 Share Posted February 19, 2011 Hello. Thanks in advance to whoever can help me. I need to know how a keypress IF statement would work. This is the code I have right now. Send("{j down}") Sleep(5000) Send("{j up}") I want to make it into an if statement, like: IF "I press 'w'" THEN hold down j then wait 5 seconds, and release j. I just don't know how do put the keypress in an if statement. Please help whoever can. thanks... Link to comment Share on other sites More sharing options...
lygersarereal Posted February 19, 2011 Author Share Posted February 19, 2011 By the way, the purpose of this thing I'm making is just to get a basic understanding of keypressed and send, and i thought of this. that way if i look at at in notepad, it will send both. PLEASE HELP!!! Link to comment Share on other sites More sharing options...
Rogue5099 Posted February 19, 2011 Share Posted February 19, 2011 (edited) If _IsPressed(57) Then ;If 'w' is pressed Send("{j down}") Sleep(5000) Send("{j up}") EndIf 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 Edited February 19, 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