set timer to do 2 different task Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
chubbychub
Posts: 20
Joined: 23 Feb 2017, 00:45

set timer to do 2 different task

30 Jun 2020, 21:42

i have the below code, that will reload the script at anytime between 4 am and 5 am
however i want to set a task if at 7am and 8am to do another task, is this possible?

Code: Select all

SetTimer, Reload, 3600000

Reload:
if(A_Hour A_min>= 400 and A_Hour A_min <= 500)
{
       Reload
}

i tried this:

Code: Select all

Reload:
if(A_Hour A_min>= 400 and A_Hour A_min <= 500)
{
       Reload
}
if(A_Hour A_min>= 700 and A_Hour A_min <= 800)
{
       msgbox, do this task
}

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

Re: set timer to do 2 different task  Topic is solved

01 Jul 2020, 02:38

Hallo,
perhaps:

Code: Select all

#Persistent
Reload := A_Hour A_Min
Gosub, Reload
Return

Reload:
IF A_Min
{ ;wait for the full hour
	SetTimer, Reload,% (60-A_Min)*60000
	Return
}
SetTimer, Reload, 3600000
Clock := A_Hour A_Min
IF Clock in  400, 500
{
	IF (Clock <> Reload)
		Reload
}
IF Clock in 700, 800
	msgbox, do this task
Return

Return to “Ask For Help”

Who is online

Users browsing this forum: boiler, DooMWhite, JaydeNpie, keanpteamos, LM_, RubbeH, slupka, Smile_, yhk and 50 guests