DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: I need a script that will left mouse click at a specific time of day.  (Read 4,084 times)

yeto

  • Participant
  • Joined in 2017
  • *
  • Posts: 2
I need a script that will left mouse click at a specific time of day. I found the following (see link)which is working but was wondering if there is now simpler code that will do the same? I will be at the computer and can position the mouse so I won't need x, y coordinates. Any help will be greatly appreciated.

site whre I copied script

Code
#persistent

TargetTime = 1800

 

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.
TimeUntilTarget -= 1000
SetTimer, ClickTimer, %TimeUntilTarget%
return

ClickTimer:
SetTimer, ClickTimer, off  ; i.e. do only one click
MouseClick, left

Thank you in advance for any help,
yeto

Target

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,840
    • Coding Snacks
just to confirm, you only need to define a time?

quick and dirty AHK code...

Code
#persistent
MyHour = 07
myMin = 07

loop
{
  if A_hour = %myhour%
    loop
    {
	if a_min = %myMin%
          click

	sleep 750
    }	
  sleep 750
}
Alcohol is photoshop, bottled
Askhole - someone who ask for advice, then ignores it
"Look wise, say nothing, and grunt. Speech was given to conceal thought" - Sir William Osler

yeto

  • Participant
  • Joined in 2017
  • *
  • Posts: 2
just to confirm, you only need to define a time?

quick and dirty AHK code...

Code
#persistent
MyHour = 07
myMin = 07

loop
{
  if A_hour = %myhour%
    loop
    {
	if a_min = %myMin%
          click

	sleep 750
    }	
  sleep 750
}

Thank you for taking time to reply. This is very helpful.
yeto

Original address: https://www.donationcoder.com/forum/index.php?topic=47983.0