Nagasa Posted January 15, 2019 Posted January 15, 2019 I'm sure this is something very simple but i cant seem to figure it out. I've tried _IsPressed, @HotkeyPressed. The solution i'm using right now requires me to hold the key until the end of the loop, but i would like a way so that the instant i press the button the loop ends and the code continues. And Thank you in advance for anyone who replies. Func example() -code- _isPressed("1B") Then ExitLoop EndFunc ~ Just Your Friendly Neighborhood Nerd With Too Much Free Time.~
Subz Posted January 16, 2019 Posted January 16, 2019 Try something like: HotKeySet("{ESC}", "_ExitLoop") Global $bLoop = True While $bLoop Sleep(100) WEnd MsgBox(4096, "Exit Loop", "Complete") Func _ExitLoop() $bLoop = False EndFunc
Nagasa Posted January 16, 2019 Author Posted January 16, 2019 37 minutes ago, Subz said: Try something like: HotKeySet("{ESC}", "_ExitLoop") Global $bLoop = True While $bLoop Sleep(100) WEnd MsgBox(4096, "Exit Loop", "Complete") Func _ExitLoop() $bLoop = False EndFunc I'm running my code within a for loop and for whatever reason the example you've provided doesn't work, even tho in theory it should. ~ Just Your Friendly Neighborhood Nerd With Too Much Free Time.~
Nagasa Posted January 16, 2019 Author Posted January 16, 2019 Never Mind it worked Thank You for whatever reason didn't work the first two times i ran the code but now its working consistently. ~ Just Your Friendly Neighborhood Nerd With Too Much Free Time.~
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