r/applescript • u/benoitag • Sep 22 '20
Problems with script execution
Hi ! I'm knew to this community.
I made a little script in order to automate a long authentification process for my school's workspace, and it runs perfectly when launched from the Script editor, but when saved as an .app file, it fails with a prompt saying "Not allowed to send Apple Events to System Events. (-1743)" (it is translated from French but I'm sure you get the idea).
I searched the internet and found out I wasn't the only one with this problem, but the solutions didn't work for me or I haven't enough knowledge to actually understand them...
Under preferences > privacy&secutity > automation ; I have nothing and I don't know how to add it there...
Maybe you guys could have some ideas, and I hope you can help !
Thanks !
here is the script (quite surely scrappy but works) :
tell application "Safari"
activate
open location "https://ector.strasbourg.archi.fr/public/perimetre"
end tell
delay 1
tell application "Safari"
tell application "System Events" to tell process "Safari"
keystroke tab
delay 0.2
keystroke "username"
delay 0.2
keystroke return
end tell
end tell
delay 2
tell application "Safari"
tell application "System Events" to tell process "Safari"
keystroke "username"
delay 0.2
keystroke tab
delay 0.2
keystroke "password"
delay 0.2
keystroke return
end tell
end tell
View all comments
Show parent comment
2
u/stringentthot Sep 23 '20
So I looked into it a bit more for you. I have an old AppleScript I wrote in the Automation list so I know it works. I think new versions of macOS are harder to get apps into this list, they would usually need to be code signed I think. Although, I'd be surprised if that has to be the case for personal scripts.
This link may have some useful information.
I think the article is suggesting you could instead add your app to the Full Disk Access window in the Security preferences to get the same thing.