Jump to content

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

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

Func SetVarToOne()
     $SpecialVar = 1
Link to post
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


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


This Interactive Demo has lots of Demonstrations



Edited by Valuater


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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...