I did not write the following script. That honor goes to Matt Coneybeare. I was able to get it working but it still prompts for a password. How do I get the script to automatically add a password? (script saved as application)
on idle
set vpnIPAddress to “xxx.xx.x.x”
set vpnServiceName to “mother”
set myIP to "xxx.x.x.x"
set shellScriptCommands to {¬
"dig +short myip.opendns.com @resolver1.opendns.com", ¬
"dig TXT +short o-o.myaddr.l.google.com @ns1.google.com | awk -F'\"' '{ print $2}'", ¬
"curl ifconfig.me", ¬
"curl -s http://checkip.dyndns.org/ | grep -o \"[[:digit:].]\\+\"", ¬
¬
""}
repeat with shellScriptCommand in shellScriptCommands
try
set myIP to do shell script shellScriptCommand
exit repeat # if successful
on error errorMessage number errorNumber
end try
end repeat
if myIP is not equal to vpnIPAddress then
tell application "System Events"
tell process "SystemUIServer"
set vpnMenu to (menu bar item 1 of menu bar 1 where description is "VPN")
tell vpnMenu to click
set connectionStatusItem to (menu item 1 of menu 1 of vpnMenu)
if title of connectionStatusItem is equal to ("Connect " & vpnServiceName) then
tell connectionStatusItem to click
end if
end tell
end tell
end if
return 90
end idle
ideas?? thank you in advance