interrupt a loop

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Trigun
Posts: 41
Joined: 29 Mar 2017, 01:33

interrupt a loop

Post by Trigun » 26 Aug 2020, 06:37

hello
i have a long loop cycle
something like 20-30 sec then wait then repeat
how i can break the loop and stop it from outside?

i tried to do something like that

Code: Select all

SetTimer, startTimer, -10
;~ SetTimer, UpdateTimer, 5000
where on the updatetimer i check for a condition and launch

Code: Select all

				SetTimer,startTimer, Off
				;~ SetTimer,startTimer,-20000
but it doesn't stop startTimer (i tried delete too without success)

startimer is something like

Code: Select all

startTimer:
loop {
function1()
if xx
function2()
...
...
}
where each function can run for 10-20 secs


if i use something like
if condition == true break
i have to add that code everywhere (in all loops, functions etc).... a bit ugly :-)
there is an alternative?

Rohwedder
Posts: 7769
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: interrupt a loop

Post by Rohwedder » 26 Aug 2020, 09:59

Hallo,
from outside the Loop? You have the choice between
Reload, ExitApp and Shutdown.
(A moving tank can easily be stopped inside. But outside?)

BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: interrupt a loop

Post by BoBo » 26 Aug 2020, 10:18

(A moving tank can easily be stopped inside. But outside?)
Uh-oh, it's obviously never too late to involve @tank into this kinda thing :lol: :silent: :angel:

Trigun
Posts: 41
Joined: 29 Mar 2017, 01:33

Re: interrupt a loop

Post by Trigun » 27 Aug 2020, 04:01

reload exitapp and shutdown will not allow me to restart the loop (both timers are started from a gui click)

Post Reply

Return to “Ask for Help (v1)”