mouse click at a specific time, v2 and v1 script compatibility

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
carole_designer
Posts: 3
Joined: 29 Nov 2023, 04:36

mouse click at a specific time, v2 and v1 script compatibility

Post by carole_designer » 29 Nov 2023, 04:48

Hello, I just discovered the application. It's very interesting. I don't know if I'm in the right section.
I want to execute a mouse click every day at a specific time.
I was able to find a template script doing this. But it told me to install v1 of autohotkey. That's what I did.

I would rather put Win 11 Pro on my other computer than v2 because this one is the most recent. Or if I put v1 on Windows 11 is it not a problem?

But if I install v2, the script below does not work? Do I need another script specific to v2 to make a mouse click every day at a specific time? https://www.autohotkey.com/board/topic/485-need-to-program-a-left-mouse-click-to-run-at-a-certain-time/

Code: Select all

#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


Thank you for your clarifications. And good day.

User avatar
mikeyww
Posts: 27213
Joined: 09 Sep 2014, 18:38

Re: mouse click at a specific time, v2 and v1 script compatibility

Post by mikeyww » 29 Nov 2023, 05:26

Welcome to this AutoHotkey forum!

You can install v1 so that your v1 scripts will work. To make v1 and v2 scripts work, both versions can be installed.

Another way to run a program at a specific time is to use the Windows Task Scheduler. The script is below.

Code: Select all

#Requires AutoHotkey v2.0
Click

carole_designer
Posts: 3
Joined: 29 Nov 2023, 04:36

Re: mouse click at a specific time, v2 and v1 script compatibility

Post by carole_designer » 29 Nov 2023, 12:55

Hello Mikey,
First of all, thank you for your welcome.
I have taken note that you can put both versions on Windows 11. This will not create any security problems or conflicts then?

And also a very good idea to use the Windows Task Scheduler. Thanks also for the corresponding script.
Could the ahk v1.1 script that I put above also be adapted to v.2? Or are the functions of the versions too different?

Wonderful evening

User avatar
mikeyww
Posts: 27213
Joined: 09 Sep 2014, 18:38

Re: mouse click at a specific time, v2 and v1 script compatibility

Post by mikeyww » 29 Nov 2023, 13:26

You can install both versions on one machine.
V1 can be translated to V2, though there is no specific need to do so.
Security is not specifically at hand here.

carole_designer
Posts: 3
Joined: 29 Nov 2023, 04:36

Re: mouse click at a specific time, v2 and v1 script compatibility

Post by carole_designer » 30 Nov 2023, 02:58

Thank you very much for your explanations. See you soon and have a very nice day for you.

Post Reply

Return to “Ask for Help (v2)”