Sign in to follow this  
Followers 0
milkman

How to use a hotkey to terminate a loop? program?

4 posts in this topic

I am a nub at this stuff. How could I use a hotkey to stop a loop? How about terminate a program?

Share this post


Link to post
Share on other sites



Hotkeyset("{ESC}","terminate")

Func terminate()
exit
endfunc


My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! you’re the best in town Fight!

Share this post


Link to post
Share on other sites

To terminate a loop, I'd suggest having the hotkey function set a variable to 1, and then back inside the loop, have the condition that if the variable is 1, exitloop. Example:

HotKeySet ("{ESC}", "SetVarToOne")
Global $SpecialVar = 0

While 1
     sleep (100)
     If $SpecialVar = 1 Then Exitloop
Wend

Func SetVarToOne()
     $SpecialVar = 1
EndFunc

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I am a nub at this stuff. How could I use a hotkey to stop a loop? How about terminate a program?

help has a great example exactly as you have requested..

go to Help and search the "topics" for "Pause" ..

You will see HOTKEY open that one

AND/OR

Take a look at "Welcome to AutoIt 1-2-3" .. here

http://www.autoitscript.com/forum/index.php?showtopic=21048#

This Interactive Demo has lots of Demonstrations

Enjoy!!!

8)

Edited by Valuater

NEWHeader1.png

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  
Followers 0