Madmenyo
Madmenyo

Reputation: 8584

Timers wait for eachother

How can i set timers to wait for each other if another is running? The documentation says if a timer wants to start with a lower thread priority it wont be running at all.

What i am looking for is a script with multiple "timers" one that goes approx each 15 minutes, one each 30 minutes one each 45 minutes, etc. These are all fairly long methods with a run time of a minute or two. They can not be run at the same time so they have to wait for each other if one is already running.

Upvotes: 0

Views: 96

Answers (2)

Grey
Grey

Reputation: 339

@TS
Need use Thread command with NoTimers parametr, for example:

; Thread, NoTimers ; uncomment/comment this line

SetTimer, SomeLabel1, 1500
SetTimer, SomeLabel2, 3000
SetTimer, SomeLabel3, 4500

Space::
   KeyWait, % A_ThisHotkey
   ExitApp

SomeLabel1:
   MsgBox, 262144, % A_LineNumber, % A_ThisLabel, % .75
   Return
SomeLabel2:
   MsgBox, 262208, % A_LineNumber, % A_ThisLabel, % .75
   Return
SomeLabel3:
   MsgBox, 262192, % A_LineNumber, % A_ThisLabel, % .75
   Return

Upvotes: 0

Robert Ilbrink
Robert Ilbrink

Reputation: 7953

Use one 15 minute timer and use a counter to launch process 2 and 3. Groet, Robert

If (Mod(A_Index, 2) = 0)
  Do Loop 2
If (Mod(A_Index, 3) = 0)
  Do Loop 3

Upvotes: 1

Related Questions