Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I have an applescript :

tell application "System Events"
    tell current location of network preferences
        set VPNService to service "VPN (Cisco IPSec)"
        if exists VPNService then
            connect VPNService
        end if
    end tell
end tell

When I execute it a dialog box is showing up and ask me for my password. I would like to automate this process and put directly my password in my script and validate automatically the dialog box.

Is there a way a to do that ?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Here is a simple solution.

tell application "System Events"
    tell current location of network preferences
        set VPNService to service "UJF"
        if exists VPNService then
            connect VPNService
        end if
    end tell
    delay 1
    keystroke "yourpassword"
end tell

If 1 second delay isn't enough for the popop to open feel free to increase it !

But don't forget, a password *should* NEVER be stored like that.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.