Using AutoIt, how to perform some action when time is at xx:00
, xx:15
, xx:30
and xx:45
(every 15min) by recognizing the actual time?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Sleep(1000 * 60 * 15)
may be used. Example as per:
"by recongnizing the actual time"
-requirement (using Mod()
and @MIN
-macro) :
Global Const $g_iInterval = 15
Global Const $g_iDelay = 10
Global Const $g_sMsg = 'Triggered at %s:%s\n'
Global $g_sLast = ''
While True
If Not (@MIN = $g_sLast) And Mod(Int(@MIN), $g_iInterval) = 0 Then
$g_sLast = @MIN
ConsoleWrite(StringFormat($g_sMsg, @HOUR, @MIN))
EndIf
Sleep($g_iDelay)
WEnd
Console output:
Triggered at 00:00
Triggered at 00:15
Triggered at 00:30
Triggered at 00:45
Triggered at 01:00
Triggered at 01:15
Triggered at 01:30
Triggered at 01:45
...