Page 1 of 1

set timer to do 2 different task

Posted: 30 Jun 2020, 21:42
by chubbychub
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
}


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

Posted: 01 Jul 2020, 02:38
by Rohwedder
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