Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (* Automation to configure vpn settings (L2TP over IPSec) *)
- set SERVICENAME to "Test"
- set VPCADDR to "xxx.xxx.xxx.xxx"
- set ACCOUNTNAME to "test"
- set psk to "testpsk"
- set PASSWD to "testpasswd"
- tell application "System Events"
- tell application "System Preferences"
- activate
- set current pane to pane "com.apple.preference.network"
- end tell
- end tell
- delay 2
- tell application "System Events"
- tell process "System Preferences"
- click button "サービスを追加" of window "ネットワーク" of application process "System Preferences" of application "System Events"
- delay 2
- click pop up button "インターフェイス:" of sheet 1 of window "ネットワーク"
- delay 1
- click menu item "VPN" of menu 1 of pop up button "インターフェイス:" of sheet 1 of window 1
- delay 2
- click pop up button "VPN タイプ:" of sheet 1 of window "ネットワーク"
- delay 1
- click menu item "L2TP over IPSec" of menu 1 of item 8 of every UI element of sheet 1 of window "ネットワーク"
- keystroke SERVICENAME
- delay 2
- click button "作成" of sheet 1 of window "ネットワーク"
- end tell
- end tell
- delay 2
- tell application "System Events"
- tell process "System Preferences"
- set ServerAddrForm to text field "サーバアドレス:" of group 1 of window "ネットワーク"
- set AccountNameForm to text field "アカウント名:" of group 1 of window "ネットワーク"
- activate
- set value of ServerAddrForm to VPCADDR
- set value of AccountNameForm to ACCOUNTNAME
- click button "認証設定..." of group 1 of window "ネットワーク"
- delay 2
- set PasswordForm to text field "パスワード:" of sheet 1 of window "ネットワーク"
- set PSKForm to text field "共有シークレット:" of sheet 1 of window "ネットワーク"
- activate
- set value of PasswordForm to PASSWD
- set value of PSKForm to psk
- click button "OK" of sheet 1 of window "ネットワーク"
- delay 2
- activate
- set vpnstatus to checkbox "メニューバーに VPN の状況を表示" of group 1 of window "ネットワーク"
- if (value of vpnstatus) = 0 then
- click vpnstatus
- end if
- end tell
- end tell
- delay 2
- tell application "System Events"
- tell process "System Preferences"
- click button "適用" of window "ネットワーク"
- delay 1
- click button "接続" of group 1 of window "ネットワーク"
- end tell
- end tell
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement