Jump to content

Autoclick at one point at specific time


Recommended Posts

Hi Everyone, is there any code that will click at one point at one specific time?  Code below is the code that ChatGPT gave, it will click at the X Y point, but it would't follow the time. It will click as soon as I execute it

#include <MsgBoxConstants.au3>
#include <Date.au3>

Local $iX = 99
Local $iY = 766
Local $sTimeToClick = "18:55:00"

While 1
    If _NowTime() >= $sTimeToClick Then
        MouseClick("left", $iX, $iY, 1, 0)
        ExitLoop
    EndIf
    Sleep(1000) ; Check every second
WEnd
 

Link to comment
Share on other sites

  • Developers
21 minutes ago, BrianYong said:

It will click as soon as I execute it

Correct as that is what the code does, so try to understand the code an fix it as we do not run a forum to correct chatgpt code and only help members that re willing to learn and think for themselves. ;) 

What is this for anyways?

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

With this you can analyze what is going on :

#include <Date.au3>
HotKeySet("{ESC}", "Terminate") ; just to terminate the script by the user

Local $iX = 99
Local $iY = 766
Local $sTimeToClick = "13:59:00"

While 1
    If _NowTime(5) >= $sTimeToClick Then
        ConsoleWrite("Click" & @CRLF) ; *** just info
        MouseClick("left", $iX, $iY, 1, 0)
        ExitLoop
    EndIf
    ConsoleWrite("NowTime = " & _NowTime(5) & "    TimeToClick = " & $sTimeToClick & @CRLF)  ; *** just info
    Sleep(1000) ; Check every second
WEnd

Func Terminate()
    Exit
EndFunc   ;==>Terminate

 

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...