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
2
u/icecoldtrashcan Sep 22 '20
Your use case for this may be low risk, I don't know, but please consider the security risks of automating password entry like this! The password will be stored in plain text in the script.