ljkkda Posted July 11, 2006 Share Posted July 11, 2006 hi i cant get it to work... so what i want is if i press the y key the message box with that right activate and if i press n the message box with wrong sorry! i know i can do that with hotkeys but i want to do that with this method is this possible? if "y" then MsgBox(4096,"","Thats right") ElseIf "n" Then MsgBox(4096,"","Wrong sorry") EndIf thx Link to comment Share on other sites More sharing options...
Skruge Posted July 11, 2006 Share Posted July 11, 2006 If you're dead-set on avoiding Hotkeys for something like this, you can use _IsPressed(). Adapted from the helpfile:#include <Misc.au3> $dll = DllOpen("user32.dll") While 1 Sleep ( 250 ) If _IsPressed("59", $dll) Then MsgBox(4096,"", "Thats right") ExitLoop ElseIf _IsPressed("4E", $dll) Then MsgBox(4096,"", "Wrong sorry") ExitLoop EndIf WEnd DllClose($dll) [font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font] Link to comment Share on other sites More sharing options...
gamepin126 Posted July 11, 2006 Share Posted July 11, 2006 _IsPressed will use 100% of your CPU, stick with HotKeySet() Link to comment Share on other sites More sharing options...
MHz Posted July 11, 2006 Share Posted July 11, 2006 (edited) A MessageBox...$answer = MsgBox(0x24, '', 'Choose yes or no') If $answer = 6 Then ; Yes pressed ElseIf $answer = 7 Then ; No was pressed EndIfAlt + y is for yes and Alt + n is for no. No hotkeys or ispressed needed. Edited July 11, 2006 by MHz Link to comment Share on other sites More sharing options...
ljkkda Posted July 11, 2006 Author Share Posted July 11, 2006 thx @ Skruge but it really use much of cpu i wonder about that...! can anyone tell why? and thx @ MHz that is a better way to do what i want ljkkda 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