我想每隔3分钟将密钥发送到我的浏览器刷新按钮(F5),但我不希望脚本受到干扰。有点像计时器。单击刷新(F5)每3分钟一次,不会干扰循环中的原始脚本?
HotKeySet("{HOME}", "Start")
AdlibRegister("refresh", 180000)
While 1
Sleep(200)
WEnd
Func refresh()
Send("{F5}")
EndFunc
Func Start()
While 1
Call "refresh"
$pink = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, 0x8a0859)
If IsArray($pink) then
MouseMove($pink[0], $pink[1], 0)
Sleep(100)
MouseClick("Left")
Else
$pink2 = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, 0x8c085a)
If IsArray($pink2) then
MouseMove($pink2[0], $pink2[1], 0)
Sleep(100)
MouseClick("Left")
Else
$pink3 = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, 0x880852)
If IsArray($pink3) then
MouseMove($pink3[0], $pink3[1], 0)
Sleep(100)
MouseClick("Left")
EndIf
EndIf
EndIf
WEnd
EndFunc
看看:AdlibRegister
AdlibRegister("refresh", 180000) ; for 3 minutes
AdlibRegister
有一个奇怪的习惯:如果你取消注册并再次注册(同时),计数器不会重置。这大部分时间都是令人讨厌/意外的,但确切地说,你需要的是:
Func Start()
AdlibUnRegister("refresh")
; your original code here
AdlibRegister("refresh", 180000)
EndFunc