How to enter password for quick windows using applescript

I'm new to applescript and am currently stuck in a prompt asking for a password.

I am creating a launcher for my daily use application and I want to automate the startup process.

Right now I only run two applications - VirtualHostX and MAMP. Later I could add a little.

Here is what I have done so far:

tell application "VirtualHostX" to activate tell application "MAMP" to activate tell application "System Events" tell process "VirtualHostX" tell menu bar 1 tell menu bar item "Web Server" tell menu 1 click menu item "Start" end tell end tell end tell end tell end tell 

When launched, it will launch two applications successfully, but Virtual Host will ask me for a password for authorization. I want to integrate my password input into a stream or code. I already tried to answer on Google, but did not find a solution for it.

I can’t target this window and enter my password. enter image description here

Let me know what I am missing.

Thanks.

+4
source share
2 answers

Password dialogs are displayed by SecurityAgent:

 tell application "System Events" to tell process "SecurityAgent" set value of text field 2 of scroll area 1 of group 1 of window 1 to "password" click button 2 of group 2 of window 1 end tell 
+6
source

For Yosemite, the SecurityAgent dialog box is different. This will work:

 tell application "System Events" tell process "SecurityAgent" set value of text field 2 of window 1 to "yourPassword" click button 2 of window 1 end tell end tell 
0
source

Source: https://habr.com/ru/post/1483522/


All Articles