unknown12 Posted March 21, 2005 Share Posted March 21, 2005 How would I make a sound play when the "U" key is pressed on the keyboard? thanks (I have looked the manual) Link to comment Share on other sites More sharing options...
unknown12 Posted March 21, 2005 Author Share Posted March 21, 2005 I got it Link to comment Share on other sites More sharing options...
automagician Posted March 21, 2005 Share Posted March 21, 2005 What did you use? I was going to say use something with this statement, but I didn't get it working yet: $ret = DllCall("user32.dll","short","GetAsyncKeyState","int", "55") Link to comment Share on other sites More sharing options...
unknown12 Posted March 21, 2005 Author Share Posted March 21, 2005 HotKeySet("u","HotKeyFunction") func HotKeyFunction() soundplay(@ScriptDir & "sound.mp3") EndFunc Link to comment Share on other sites More sharing options...
automagician Posted March 21, 2005 Share Posted March 21, 2005 Wow, I was making it much harder than it had to be Link to comment Share on other sites More sharing options...
Blue_Drache Posted March 21, 2005 Share Posted March 21, 2005 What did you use?I was going to say use something with this statement, but I didn't get it working yet:$ret = DllCall("user32.dll","short","GetAsyncKeyState","int", "55")<{POST_SNAPBACK}>LoL... overly complicated, but probably a good learning experience anyway. I'd be interested in seeing if you can get it done with a DLL call....that way you don't have to tie up a hotkey with "HotKeySet" Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
automagician Posted March 21, 2005 Share Posted March 21, 2005 (edited) How about this: $initial = DllCall("user32.dll","short","GetKeyState","int", 0x55) While 1 $ret = DllCall("user32.dll","short","GetKeyState","int", 0x55) If NOT ($ret[0] = $initial[0]) Then ; Do what you want here!!! Exit(0) EndIf WEnd Now you don't have to tie up the HotKey Edited March 21, 2005 by automagician 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