Robbinski12 Posted August 26, 2009 Share Posted August 26, 2009 Hello all, I was just about to post a question about this when I found a workaround. See, this was my problem. I had a nice script, but pressing escape made it exit. My solution?HotKeySet("{ESCAPE}", "escapeFunction") Func escapeFunction() EndFunc I know it's not a perfect solution, but I wanted to share it anyway. If anyone's got a better idea, I'd love to hear it. Robin krasnoshtan 1 Link to comment Share on other sites More sharing options...
Andreik Posted August 26, 2009 Share Posted August 26, 2009 HotKeySet("{ESC}","Quit") ;Press ESC key to quit While True ;Here start main loop Sleep(20) WEnd Func Quit() Exit EndFunc Link to comment Share on other sites More sharing options...
Robbinski12 Posted August 28, 2009 Author Share Posted August 28, 2009 (edited) Yeh, that's the opposite of what I mean... I want Escape NOT to stop my script, thought I said that EDIT: Yeh, I did Edited August 28, 2009 by Robbinski12 Link to comment Share on other sites More sharing options...
jvanegmond Posted August 28, 2009 Share Posted August 28, 2009 Here's what you do: If this is the original script: HotKeySet("{ESC}","Quit") ;Press ESC key to quit While True ;Here start main loop Sleep(20) WEnd Func Quit() Exit EndFunc Then here it is without stopping on escape: While True ;Here start main loop Sleep(20) WEnd Simple. github.com/jvanegmond Link to comment Share on other sites More sharing options...
Manjish Posted August 28, 2009 Share Posted August 28, 2009 (edited) Another alternative #Include <Misc.au3> while 1 ; put ur script here If _IsPressed("1B",'user32.dll') Then EndIf WEnd Edited August 28, 2009 by Manjish [font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com Link to comment Share on other sites More sharing options...
jvanegmond Posted August 28, 2009 Share Posted August 28, 2009 Another alternative: #Include <Misc.au3> while 1 ; put ur script here If _IsPressed("1B",'user32.dll') Then EndIf WEnd Congratulations. After two times posting, him explaining he DOES NOT want to stop on escape, you still managed to read over it. github.com/jvanegmond Link to comment Share on other sites More sharing options...
Manjish Posted August 28, 2009 Share Posted August 28, 2009 @manadar, I know that he dosnt want to stop on esc.. That's exactly what my script does dude!! check!! krasnoshtan 1 [font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com Link to comment Share on other sites More sharing options...
jvanegmond Posted August 28, 2009 Share Posted August 28, 2009 Oh, it was a joke.... Haha.. github.com/jvanegmond Link to comment Share on other sites More sharing options...
Robbinski12 Posted August 28, 2009 Author Share Posted August 28, 2009 (edited) But the problem is, without me writing it, it DOES now stop on escape My question still is, how can I stop it doing that? EDIT: With my solution (first post), I cannot use my escape key anymore because my script now catches it -,- Edited August 28, 2009 by Robbinski12 Link to comment Share on other sites More sharing options...
trancexx Posted August 28, 2009 Share Posted August 28, 2009 But the problem is, without me writing it, it DOES now stop on escape My question still is, how can I stop it doing that?EDIT: With my solution (first post), I cannot use my escape key anymore because my script now catches it -,-You should be in full control of your code. You wrote your script? ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
jvanegmond Posted August 28, 2009 Share Posted August 28, 2009 (edited) But the problem is, without me writing it, it DOES now stop on escape My question still is, how can I stop it doing that? EDIT: With my solution (first post), I cannot use my escape key anymore because my script now catches it -,- Here's what you do: If this is the original script: HotKeySet("{ESC}","Quit") ;Press ESC key to quit While True ;Here start main loop Sleep(20) WEnd Func Quit() Exit EndFunc Then here it is without stopping on escape: While True ;Here start main loop Sleep(20) WEnd Simple. Edit: Are you using a GUI? If so, then you must call this method to stop it exiting on escape: AutoItSetOption("GUICloseOnESC") Edited August 28, 2009 by Manadar MilenP 1 github.com/jvanegmond Link to comment Share on other sites More sharing options...
NobodySpecial Posted June 2, 2011 Share Posted June 2, 2011 Here's what you do: If this is the original script: HotKeySet("{ESC}","Quit") ;Press ESC key to quit While True ;Here start main loop Sleep(20) WEnd Func Quit() Exit EndFunc Then here it is without stopping on escape: While True ;Here start main loop Sleep(20) WEnd Simple. Edit: Are you using a GUI? If so, then you must call this method to stop it exiting on escape: AutoItSetOption("GUICloseOnESC") I know this is an old topic, but it's what shows up on Google Search still, and the answer is not complete.. I want to complete it for other people who might find this in search. You are not a very nice helper BTW! Anyways you need to set it like so- AutoItSetOption("GUICloseOnESC", 0) Link to comment Share on other sites More sharing options...
trancexx Posted June 2, 2011 Share Posted June 2, 2011 I know this is an old topic, but it's what shows up on Google Search still, and the answer is not complete..I want to complete it for other people who might find this in search.You are not a very nice helper BTW!Yeah, he is a phony.Thank you for providing the solution for the rest of us in need. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
alankam58 Posted August 16, 2019 Share Posted August 16, 2019 add Opt("GUICloseOnESC", 0) on the beginning of your script to prevent "ESC" press exiting GUI. 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