AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Need to program a Left Mouse Click to run at a certain time

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
hockeymatt
Guest





PostPosted: Mon Jul 19, 2004 8:10 am    Post subject: Need to program a Left Mouse Click to run at a certain time Reply with quote

I am interested to know if anyone knows how to run a Left Click option to run at a specific time.

Windows...can display a time frame of hundredths of seconds 01103466 or 01:10:34:66

Any ideas on having a Left Click hot key run at a specific time interval?

Assuming that the mouse has already been positioned, thus no worrying about x and y positioning.

Thanks,

Matt
Back to top
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10464

PostPosted: Mon Jul 19, 2004 1:52 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group