Jump to content
Sign in to follow this  

Terminte a script with hotkey problem

Recommended Posts


I'm trying to write Autoit script that does a few simple drag and drop in a window. That works fine. But I'd also like to be able to abort the commands when the script is running by pressing the ENTER key.

I defined a hotkey for ENTER associated to a terminate function as I have seen done in a post in this forum.

I also enveloped the commands of the body of the script in a For loop that runs exactly one time, because I read in the Autoit help file that a hotkey interrupts the current function or statement. (maybe the For loop isn't necessary, but anyway the hotkey doesn't work without it either).

My problem is that when executing the commands in the For loop, my pressing the ENTER key has no effect at all. The commands go on being executed regardless.

Thankyou for any help.

My script:

HotKeySet("{ENTER}", "Terminate")

Func Terminate()

Exit 0


For $i=0 to 0



MouseClick ( "left", 236, 570 , 10)


Share this post

Link to post
Share on other sites

it works fine for me

[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Share this post

Link to post
Share on other sites

Exit 0 and 0 to 0?

Edited by Aassdd

Share this post

Link to post
Share on other sites

Exit 0 means exit with return code 0, ie. no error.

the 0 to 0 part boggles me too.. lol

There's no need to use a loop if the script is just supposed to do it's magic once...

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.