Related: Sleep Until Time by None
Sleep(n,u) { ; Sleep in seconds, minutes, hours or days. By Learning one, SKAN and MasterFocus.
Sleep, % ( n*1000* (((u:=SubStr(u,1,1))="s") ? 1 : (u="m") ? 60 : (u="h") ? 3600 : (u="d") ? 86400 : 0 ))
}
/*
; Examples:
Sleep(3, "seconds") ; (seconds,second,sec,s --> all the same)
Sleep(1, "min") ; (minutes,minute,min,m --> all the same)
Sleep(1, "h") ; (hours,hour,h --> all the same)
Sleep(0.5, "day") ; (days,day,d --> all the same)
*/Original version:Sleep(number,unit) { ; Sleep in seconds, minutes, hours or days. By Learning one.
Static u := "s1000|m60000|h3600000|d86400000"
Loop, parse, u, |
{
if (SubStr(A_LoopField,1,1) = SubStr(unit,1,1))
Sleep, % number*SubStr(A_LoopField,2)
}
}




