My automated "click" Applescript has just stopped working

Right up until a week ago, my simple Applescript that had to simply click on a specific coordinate on screen just stopped working.

Here is the Applescript:

tell application "System Events"
click at {693, 619}
end tell

And I automate it's trigger at a specific time of day with the help of osascript (recommended for Applescripts) using the following 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>

I've added this plist file to the LaunchDaemons folder of my core Library folder. This will ensure it's a global daemon, so it should have the highest chance of always triggering correctly. Beyond that, I've given all the relevant access and permissions (Accessibility, Automation, disk access etc) for this setup to work correctly.

To ensure the job is loaded correctly and functional, I use an application called Launchcontrol 2. Over there, it is always loaded in correctly and the status shows as OK.

Despite all these checks and balances, the script just doesn't click on the specific coordinate no more. It was always working perfectly fine up until a week ago and I haven't made any changes whatsoever to this whole setup.

The Launchcontrol 2 application has some launchd(8) logs of the job trigger event at the designated time that I would like to share. Perhaps it will help with the debugging. Here it is:

2024-10-22 06:10:03.808584 <Notice> internal event: WILL_SPAWN, code = 0
2024-10-22 06:10:03.808688 <Notice> service state: spawn scheduled
2024-10-22 06:10:03.808692 <Notice> service state: spawning
2024-10-22 06:10:03.808727 <Notice> launching: xpc event
2024-10-22 06:10:03.810543 <Notice> xpcproxy spawned with pid 28683
2024-10-22 06:10:03.810593 <Notice> internal event: SPAWNED, code = 0
2024-10-22 06:10:03.810599 <Notice> service state: xpcproxy
2024-10-22 06:10:03.810718 <Notice> internal event: SOURCE_ATTACH, code = 0
2024-10-22 06:10:03.827675 <Notice> service state: running
2024-10-22 06:10:03.827703 <Notice> internal event: INIT, code = 0
2024-10-22 06:10:03.827709 <Notice> job state = running
2024-10-22 06:10:03.827726 <Notice> Successfully spawned osascript[28683] because xpc event
2024-10-22 06:10:10.104597 <Notice> exited due to exit(0), ran for 6293ms
2024-10-22 06:10:10.104617 <Notice> service state: exited
2024-10-22 06:10:10.104630 <Notice> internal event: EXITED, code = 0
2024-10-22 06:10:10.104633 <Notice> job state = exited
2024-10-22 06:10:10.104665 <Notice> service inactive: com.mouseclick.plist
2024-10-22 06:10:10.104681 <Notice> service state: not running

To the best of my knowledge, I've checked everything possible from my end and am still faced with this roadblock. I'd really appreciate your support here!


Condensed view of what I've tried so far:


  • Under the Privacy & Security settings section, I enabled Accessibility for osascript, launchcontrol and the script editors I've used for the Applescript and the plist file. See image attached below. Accessibility Settings
  • Under the Privacy & Security settings section, under Automation, the requisite access has been given to Osascript and relevant applications. See image attached below. Automation Settings
  • Ensured the job is loaded correctly with no errors and that it is loaded in as a global daemon (by adding the plist file to the LaunchDaemons foler in my core Library folder). See image attached below. Launchcontrol 2 job view
  • Verified the script file and plist file and found no syntax errors (code used for both has been shared above).
  • Ran the script file from the Script Editor itself to confirm if it's working fine and got the following results. See image attached below. Script run results


[Edited by Moderator]


MacBook Air 13″, macOS 14.5

Posted on Oct 21, 2024 11:38 PM

Reply
Question marked as Top-ranking reply

Posted on Oct 22, 2024 11:51 PM

Hey everyone,


Bumping this up. Any ideas on what might be causing this?


For more context, the click is supposed to happen on a Google Chrome window that I keep fully active and in the foreground in the moments leading upto the trigger in order to ensure nothing breaks.

And still the script fails to trigger properly and actually click...

4 replies
Question marked as Top-ranking reply

Oct 22, 2024 11:51 PM in response to Santoros

Hey everyone,


Bumping this up. Any ideas on what might be causing this?


For more context, the click is supposed to happen on a Google Chrome window that I keep fully active and in the foreground in the moments leading upto the trigger in order to ensure nothing breaks.

And still the script fails to trigger properly and actually click...

Nov 3, 2024 10:49 PM in response to Santoros

Update:


I managed to get it resolved. Turn out that for some reason, the Google Chrome UI wasn't clickable by "System Events". When I opened the same webpage where I needed the click to happen on Safari, everything worked fine and dandy like before.

So it seems like the core issue here resided with Google Chrome. Some recent update must've made it's interface non-clickable by "System Events".

That's it! Nothing was wrong with the script or the automation, it was Google Chrome all along.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

My automated "click" Applescript has just stopped working

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.