Is there a way to exclude timers from pausing? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Loop
Posts: 169
Joined: 07 Jan 2019, 14:51

Is there a way to exclude timers from pausing?

Post by Loop » 09 Aug 2022, 15:07

My script looks like this:

Code: Select all

CoordMode, ToolTip
i := 1
SetTimer, Timer, 500

Loop   {
   ToolTip % "Loop count: " . A_Index, 0, 0, 1
   Sleep, 500
}

Timer:
   ToolTip % "Timer count: " . i++, 200, 0, 2
   Return


F6::Pause

Now when I pause my script, the loop should pause but timer should keep running.

Does anyone have an idea?
Many thanks in advance

User avatar
mikeyww
Posts: 26885
Joined: 09 Sep 2014, 18:38

Re: Is there a way to exclude timers from pausing?

Post by mikeyww » 09 Aug 2022, 15:27

Why should the timer keep running?

Explained: Pause

teadrinker
Posts: 4326
Joined: 29 Mar 2015, 09:41
Contact:

Re: Is there a way to exclude timers from pausing?  Topic is solved

Post by teadrinker » 09 Aug 2022, 18:04

Code: Select all

CoordMode, ToolTip
i := 1
DllCall("SetTimer", "Ptr", A_ScriptHwnd, "Ptr", id := 1, "UInt", 500, "Ptr", RegisterCallback("MyTimer", "F"))

Loop   {
   ToolTip % "Loop count: " . A_Index, 0, 0, 1
   Sleep, 500
}

MyTimer() {
   global i
   ToolTip % "Timer count: " . i++, 200, 0, 2
}

F6::Pause

User avatar
mikeyww
Posts: 26885
Joined: 09 Sep 2014, 18:38

Re: Is there a way to exclude timers from pausing?

Post by mikeyww » 09 Aug 2022, 18:11

(Answer: because teadrinker wrote this script). :thumbup:


Loop
Posts: 169
Joined: 07 Jan 2019, 14:51

Re: Is there a way to exclude timers from pausing?

Post by Loop » 10 Aug 2022, 09:29

Many Thanks!

Post Reply

Return to “Ask for Help (v1)”