Jump to content
Sign in to follow this  
Robbinski12

Escape to stop Script

Recommended Posts

Robbinski12

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

Share this post


Link to post
Share on other sites
Andreik

HotKeySet("{ESC}","Quit") ;Press ESC key to quit

While True      ;Here start main loop
    Sleep(20)
WEnd

Func Quit()
    Exit
EndFunc


When the words fail... music speaks

Share this post


Link to post
Share on other sites
Robbinski12

Yeh, that's the opposite of what I mean...

I want Escape NOT to stop my script, thought I said that :D

EDIT: Yeh, I did

Edited by Robbinski12

Share this post


Link to post
Share on other sites
Manjish

Another alternative

#Include <Misc.au3>

while 1 ; put ur script here
    If _IsPressed("1B",'user32.dll') Then
    
EndIf
WEnd
Edited by Manjish

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

Share this post


Link to post
Share on other sites
Manjish

@manadar,

I know that he dosnt want to stop on esc..

That's exactly what my script does dude!! check!! :D


[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

Share this post


Link to post
Share on other sites
Robbinski12

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

Share this post


Link to post
Share on other sites
trancexx

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

Share this post


Link to post
Share on other sites
jvanegmond

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

Share this post


Link to post
Share on other sites
NobodySpecial

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)

Share this post


Link to post
Share on other sites
trancexx

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

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.