loki1982 Posted July 19, 2007 Share Posted July 19, 2007 I have a loop that has 4 hotkeys setup. The fourth hotkey is 'e' for exit. When I hit 'e' ,I exit from the loop, but anytime any of the other 3 hotkeys 'p','o', or 'i' is pressed from that point on they still operate. I want to exit from the loop once 'e' is pressed, and then e,p,o,i to not work anymore. While $ExitValue = 1 HotKeySet("p", "LogLocation") HotKeySet("o", "LogColor") HotKeySet("i", "LogColorAndLocation") HotKeySet("e", "ExitLoop1") sleep(1000) WEnd Func ExitLoop1() $ExitValue = 0 EndFunc I know that I am exiting the loop since other functions work, that do not work will im inside the loop will work after hitting 'e'. Link to comment Share on other sites More sharing options...
loki1982 Posted July 19, 2007 Author Share Posted July 19, 2007 (edited) I have a loop that has 4 hotkeys setup. The fourth hotkey is 'e' for exit. When I hit 'e' ,I exit from the loop, but anytime any of the other 3 hotkeys 'p','o', or 'i' is pressed from that point on they still operate. I want to exit from the loop once 'e' is pressed, and then e,p,o,i to not work anymore. While $ExitValue = 1 HotKeySet("p", "LogLocation") HotKeySet("o", "LogColor") HotKeySet("i", "LogColorAndLocation") HotKeySet("e", "ExitLoop1") sleep(1000) WEnd Func ExitLoop1() $ExitValue = 0 EndFunc I know that I am exiting the loop since other functions work, that do not work will im inside the loop will work after hitting 'e'. Hmm now that I think about it, I must have been braindead. This is a horrible way of accomplishing what I want. I guess I should just capture the key that is pressed, and do a case statement. I dunno why I didnt think of that before I wrote this out ; / ok fixed it for anyone that might be curious If _IsPressed("50", $dll) Then MsgBox(0,"_IsPressed", "P") EndIf If _IsPressed("4F", $dll) Then MsgBox(0,"_IsPressed", "O") EndIf Edited July 19, 2007 by loki1982 Link to comment Share on other sites More sharing options...
Skizmata Posted September 3, 2007 Share Posted September 3, 2007 I need to be able to use something like this to make more flexible hotkeys I'm working on a simple program to replace one key with another when in a game (F2 to Left Arrow and F6 to Right Arrow) but I don't want it to effect the rest of the system when the game isn't active. Would it be possible to see the rest of your script so that I could learn more about how your handling the hotkeys here. Thanks you! AutoIt changed my life. Link to comment Share on other sites More sharing options...
Golbez Posted September 3, 2007 Share Posted September 3, 2007 While $ExitValue = 1 HotKeySet("p", "LogLocation") HotKeySet("o", "LogColor") HotKeySet("i", "LogColorAndLocation") HotKeySet("e", "ExitLoop1") sleep(1000) WEnd Func Pause() sleep(1000) endfunc Func ExitLoop1() HotKeySet("p", "Pause") HotKeySet("o", "Pause") HotKeySet("i", "Pause") HotKeySet("e", "Pause") $ExitValue = 0 EndFunc Link to comment Share on other sites More sharing options...
Siao Posted September 3, 2007 Share Posted September 3, 2007 (edited) but I don't want it to effect the rest of the system when the game isn't active.That's what conditional statements and WinActive() are for. Edited September 3, 2007 by Siao "be smart, drink your wine" 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