Jump to content

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


milkman
 Share

Recommended Posts

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

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

Link to comment
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
 Share

  • Recently Browsing   0 members

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