Wednesday, December 4, 2024

automator – My automated “click on” Applescript has simply stopped working

Proper up till every week in the past, my easy Applescript that needed to merely click on on a particular coordinate on display simply stopped working.

Right here is the Applescript:

inform utility "System Occasions"
click on at {693, 619}
finish inform

And I automate it is set off at a particular time of day with the assistance of osascript (really helpful for Applescripts) utilizing the next plist file.

<?xml model="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist model="1.0">
<dict>
    <key>Label</key>
    <string>com.mouseclick.plist</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/bin/osascript</string>
        <string>/Customers/mugenvoid/Downloads/mouseclick.scpt</string>
    </array>
    <key>StartCalendarInterval</key>
    <dict>
        <key>Hour</key>
        <integer>6</integer> <!-- Regulate the hour as wanted -->
        <key>Minute</key>
        <integer>10</integer> <!-- Regulate the minute as wanted -->
    </dict>
</dict>
</plist>

I’ve added this plist file to the LaunchDaemons folder of my core Library folder. This may guarantee it is a international daemon, so it ought to have the best likelihood of all the time triggering appropriately. Past that, I’ve given all of the related entry and permissions (Accessibility, Automation, disk entry and so on) for this setup to work appropriately.

To make sure the job is loaded appropriately and practical, I exploit an utility referred to as Launchcontrol 2. Over there, it’s all the time loaded in appropriately and the standing exhibits as OK.

Regardless of all these checks and balances, the script simply does not click on on the particular coordinate no extra. It was all the time working completely fantastic up till every week in the past and I have never made any modifications in any respect to this complete setup.

The Launchcontrol 2 utility has some launchd(8) logs of the job set off occasion on the designated time that I want to share. Maybe it’s going to assist with the debugging. Right here it’s:

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

To the very best of my data, I’ve checked every thing doable from my finish and am nonetheless confronted with this roadblock. I might actually admire your help right here!

Condensed view of what I’ve tried thus far:

  • Beneath the Privateness & Safety settings part, I enabled
    Accessibility for osascript, launchcontrol and the script editors
    I’ve used for the Applescript and the plist file. See picture hooked up
    under. Accessibility Settings
  • Beneath the Privateness & Safety settings part, below Automation, the
    requisite entry has been given to Osascript and related
    purposes. See picture hooked up under. Automation Settings
  • Ensured the job is loaded appropriately with no errors and that it’s
    loaded in as a world daemon (by including the plist file to the
    LaunchDaemons foler in my core Library folder). See picture hooked up
    under. Launchcontrol 2 job view
  • Verified the script file and plist file and located no syntax errors
    (code used for each has been shared above).
  • Ran the script file from the Script Editor itself to verify if it is
    working fantastic and obtained the next outcomes. See picture hooked up under.
    Script run outcomes

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles