I'm not an AppleScript coder or a technical person by any means but I have done some research and came across a solution for my problem statement.
My problem statement
How to make a mouse click happen at a specified time.
To that end, I have found a simple script online that makes the mouse cursor click.
Here it is.
tell application "System Events"
click
end tell
And now, I am trying to trigger this script at a certain using launchd.
I have created a plist file under the "LaunchAgents" folder in Library as you can see in the screenshot below.
I have configured this plist file to trigger the script at 6AM my time. I even open the webpage and position my cursor just above the item that I want clicked in order to reduce complexity.
Coding of the plist file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.mouseclick.plist</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/osascript</string>
<string>/Users/mugenvoid/Downloads/mouseclick.scpt</string>
</array>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>6</integer> <!-- Adjust the hour as needed -->
<key>Minute</key>
<integer>10</integer> <!-- Adjust the minute as needed -->
</dict>
</dict>
</plist>
But for the life of me, I just cannot get it to trigger at the concerned time even after I load this plist file into launchd.
This is the guide I've been trying to use --> https://www.maketecheasier.com/use-launchd-run-scripts-on-schedule-macos/
Would appreciate some help here.
Automator
in this Q&A to achieve my objective. Also - I learned some time ago that the 3rd-party app LaunchControl is so much more efficient than diddling around with that stuff in your guide that it's impossible to ignore; i.e. I recommend LaunchControl highly! – Seamus Mar 26 '24 at 08:42<name>.workflow
file. What I had to do was write a script that calledautomator
, and process the data retrieved with my script. – Seamus Mar 27 '24 at 01:55At work, I punch my hours in and out using a website called Replicon. And at times, I run the graveyard shift. So during the latter half of such a shift, I may not always be around my device to punch myself out at the right time, which may lead to complications for me down the road.
– Anshu Chang Mar 29 '24 at 23:12