How can i get a script waiting for a password

Hi,

I’m making a script to connect to my work-PC with a VPN-connection.
It’s a VPN Cisco IPSec
I’ve made this script and it works:

But I want that the script to wait until I’ve giving my password and pushed the Enter-button. Actually I want the script to wait until the connection is established.

I don’t think it’s very difficult, but i Don’t know how.
I hope somebody can help me.

Thanks in advance

Have Fun
Fons

set pWord to ""
repeat until pWord is not ""
	set {text returned:pWord} to (display dialog "Enter pass:" default answer "" buttons {"OK"} default button 1 with hidden answer)
end repeat
set pWord to ""
repeat until pWord is not ""
	set {text returned:pWord} to (display dialog "Enter pass:" default answer "" buttons {"OK", "Cancel"} default button 1 with hidden answer)
end repeat

without a “cancel” button the script can’t exit if password is not entered

Thanks for your quick reaction!! :smiley:

But when the script is connecting I get a window with my username in it and I’ve to put the password in that window.
So I don’t think this will work, because I’m not making the dialog.
But thanks anyway!

with UI scripting, you can get the password entered in that window. Though its very easy to do UI scripting, I cannot point you to any article explaining how to use it.

Thanks anyway.

It’s not that a want the password entered. I just want to wait until the connection really has established and when it is then I want to go on with the script.

I haven’t tested this, maybe it helps


tell application "System Events"
	tell network preferences
		tell service "VPN_work"
			connect
			repeat until current configuration is connected
				delay 0.2
			end repeat
		end tell
	end tell
end tell

:smiley: :smiley: Thanks StefanK :smiley: :D,

This is what I want!! Great!!
Thanks again!!!