4.4 C
United States of America
Saturday, November 23, 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 screen simply stopped working.

Right here is the Applescript:

inform software "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 useful 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> <!-- Modify the hour as wanted -->
        <key>Minute</key>
        <integer>10</integer> <!-- Modify the minute as wanted -->
    </dict>
</dict>
</plist>

I’ve added this plist file to the LaunchDaemons folder of my core Library folder. It will guarantee it is a world daemon, so it ought to have the best probability of all the time triggering accurately. Past that, I’ve given all of the related entry and permissions (Accessibility, Automation, disk entry and so forth) for this setup to work accurately.

To make sure the job is loaded accurately and purposeful, I exploit an software referred to as Launchcontrol 2. Over there, it’s all the time loaded in accurately 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 positive up till every week in the past and I have not made any modifications by any means to this entire setup.

The Launchcontrol 2 software has some launchd(8) logs of the job set off occasion on the designated time that I want to share. Maybe it should 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 as a result 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 most effective of my data, I’ve checked the whole lot doable from my finish and am nonetheless confronted with this roadblock. I might actually admire your assist right here!

Condensed view of what I’ve tried up to now:

  • Underneath 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 connected
    under. Accessibility Settings
  • Underneath the Privateness & Safety settings part, underneath Automation, the
    requisite entry has been given to Osascript and related
    functions. See picture connected under. Automation Settings
  • Ensured the job is loaded accurately with no errors and that it’s
    loaded in as a worldwide daemon (by including the plist file to the
    LaunchDaemons foler in my core Library folder). See picture connected
    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 substantiate if it is
    working positive and acquired the next outcomes. See picture connected under.
    Script run outcomes

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles