Chris Site Admin
Joined: 02 Mar 2004 Posts: 10464
|
Posted: Mon Jul 19, 2004 1:52 pm Post subject: |
|
|
If you want it at a specific time interval, over and over again, and not at a specific time of day, the below example will click every 60 seconds:
| Code: | SetTimer, ClickTimer, 60000
return
ClickTimer:
MouseClick, left
return |
However, if you want the click to happen at a specific time of day:
| Code: | #persistent
TargetTime = 1400 ; run at 2pm, which is 1400.
StringLeft, TargetDateTime, A_Now, 8 ; Put just YYYYMMDD into the variable.
TargetDateTime = %TargetDateTime%%TargetTime%
TimeUntilTarget = %TargetDateTime%
TimeUntilTarget -= %A_Now%, seconds
if TimeUntilTarget < 0
{
MsgBox The target time is already past!
return
}
TimeUntilTarget *= 1000 ; Convert to milliseconds.
SetTimer, ClickTimer, %TimeUntilTarget%
return
ClickTimer:
SetTimer, ClickTimer, off ; i.e. do only one click
MouseClick, left
return |
|
|