Closed felipekunzler closed 7 months ago
I have this issue too. I don't think this is related to the script itself, as I've seen similar stuff when looking into how to fix it. In the end, I assumed it was just a macOS bug and gave up, though.
Thanks for raising the issue. Quickest update is that I can confirm the problem you're having. 🤔 You are right, it's not you it's macOS. I've even done a reboot and it makes no difference… (reference for historical reasons: macOS. Sonoma, 14.3 (23D56)). I have had this issue before, so let me have a play around and work on it…
Solved! There is a bug in the way that macOS and Script Editor work together.
Rather than using the File > Save (or Save As) menu, instead we need to use the File > Export menu and tick and select CodeSign: SignToRunLocally
. See the image below:
This won't work:
Instead, we must do this:
which presents the usual first permission request:
Put upon running the application, we now get this necessary second request:
This second request places a new entry in the Privacy & Security > Automation menu and then allows system events to be selected in the automation menu, which makes all the difference.
… It's late in my time zone right now, but I'll update the documentation on the main page soon about this.
this isn't working for me :( I can't get the second request to pop up - any idea how to fix this?
@magnanimous123 if you want to try doing the file export method above, but instead export to your desktop rather than directly to the Applications folder. Try running it then from the desktop. Hopefully you will get both messages if you follow the above screenshots - if it works, then move finally to the Applications folder. Try and let me know how you get on…
I could not get it working either... -25211 is what i get still, regardless where i save.
Likewise, I cannot get the second pop up to appear so that I can allow the Automation when saving the script as an application in the Applications folder. Running Sonoma 14.4.1. The second pop up did appear when I saved the script as an application on my desktop. Thank you for your work on this!
Apologies for checking but thanks for being thorough and ensuring it works by the desktop route… Annoying but glad we have a work around at least! I'm gonna close this issue for now.
in my case, i had to create an empty script, copy the script, and export (following readme) but with a different previous exported name and done
Getting the following error even after adding the app to the accessibility list under Privacy & Security and restarting the laptop. Script runs fine using Script Editor. Wondering if that's just me.