Direct access not available

Hello everyone. I created a program in Applescript. This program acts directly on the Finder drop-down menu. The program "clicks" in the "Off" menu through the hierarchies click menu item "Turn off" of menu 1 of menu bar item "Apple" via tell "Process Finder" of the "System Events" application. When I run the application, a message: "Direct access not available" appears in error. I installed the "Accessibility" authorization of System Preferences but it doesn't help. The curious thing is when I run this program by being a simple script (by clicking on the Execute script arrow) the operation takes place correctly without error. I searched the internet everywhere but to no avail. It's beyond me. Can you help me?

The Accessiblity authorization in the Privacy tab of the Security & Privacy pane of System Preferences thinks that an AppleScript applet has turned into a new and different application every time you edit, recompile and re-save the applet. Your Mac therefore thinks the revised applet is unauthorized and refuses to run it. You can quickly and easily solve this problem by unchecking and re-checking the applet's checkbox in the Accessibility authorization. The applet will then run correctly when you double-click it.

Here's a simple script to test this:

activate application "Finder" tell application "System Events" tell process "Finder" click menu item 1 of menu 1 of menu bar item "Apple" of menu bar 1 end tell end tell

The Accessiblity authorization in the Privacy tab of the Security & Privacy pane of System Preferences thinks that an AppleScript applet has turned into a new and different application every time you edit, recompile and re-save the applet.

You can prevent this by signing your applet with a stable code signing identity.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Direct access not available
 
 
Q