Jump to content

Escape to stop Script


Recommended Posts

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

Link to comment
Share on other sites

But the problem is, without me writing it, it DOES now stop on escape :D

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 by Robbinski12
Link to comment
Share on other sites

But the problem is, without me writing it, it DOES now stop on escape :D

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

But the problem is, without me writing it, it DOES now stop on escape :D

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 by Manadar
Link to comment
Share on other sites

  • 1 year later...

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

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

  • 8 years later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...