--Start with the assumption that script did not work
set gConfig to false
--Get values needed to connect (server, username, password)
try
do shell script "curl https://vpn.google.com/getpass/ > ~/.googlevpn"
set gserver to do shell script "grep '.*' ~/.googlevpn | perl -ne 'print $1 if /(.*);'"
set gUser to do shell script " grep '.*' ~/.googlevpn | perl -ne 'print $1 if /(.*);'"
set gPass to do shell script " grep '.*' ~/.googlevpn | perl -ne 'print $1 if /(.*);'"
set gConfig to true
do shell script "rm ~/.googlevpn"
on error
display dialog "Could not download credentials from vpn.google.com" buttons "OK" default button 1
stop
end try
--Connect to Google VPN with Internet Connect
if gConfig then
try
tell application "Internet Connect" to connect configuration "VPN (PPTP)" as user gUser to telephone number gserver with password gPass
on error
display dialog "Error in Internet Connection settings." buttons "OK" default button 1
end try
end if