Reputation: 63
I want to send the key to my browser refresh button (F5), every 3 minutes, but I don't want that the script will be interfered. Something like a timer. Click refresh (F5) every 3 minutes without interfering with the original script in the loop?
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
Upvotes: 0
Views: 126
Reputation: 56180
AdlibRegister
has a strange habit: if you unregister and register again (with the same time), the counter does not reset. That's annoying/unexpected most of the time, but exactly, what you need here:
Func Start()
AdlibUnRegister("refresh")
; your original code here
AdlibRegister("refresh", 180000)
EndFunc
Upvotes: 1
Reputation: 9545
take a look at : AdlibRegister
AdlibRegister("refresh", 180000) ; for 3 minutes
Upvotes: 1