Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.38 KB | None | 0 0
  1. (* Automation to configure vpn settings (L2TP over IPSec) *)
  2.  
  3. set SERVICENAME to "Test"
  4. set VPCADDR to "xxx.xxx.xxx.xxx"
  5. set ACCOUNTNAME to "test"
  6. set psk to "testpsk"
  7. set PASSWD to "testpasswd"
  8.  
  9. tell application "System Events"
  10. tell application "System Preferences"
  11. activate
  12. set current pane to pane "com.apple.preference.network"
  13. end tell
  14. end tell
  15.  
  16. delay 2
  17.  
  18. tell application "System Events"
  19. tell process "System Preferences"
  20. click button "サービスを追加" of window "ネットワーク" of application process "System Preferences" of application "System Events"
  21.  
  22. delay 2
  23.  
  24. click pop up button "インターフェイス:" of sheet 1 of window "ネットワーク"
  25. delay 1
  26. click menu item "VPN" of menu 1 of pop up button "インターフェイス:" of sheet 1 of window 1
  27.  
  28. delay 2
  29.  
  30. click pop up button "VPN タイプ:" of sheet 1 of window "ネットワーク"
  31. delay 1
  32. click menu item "L2TP over IPSec" of menu 1 of item 8 of every UI element of sheet 1 of window "ネットワーク"
  33.  
  34. keystroke SERVICENAME
  35.  
  36. delay 2
  37.  
  38. click button "作成" of sheet 1 of window "ネットワーク"
  39. end tell
  40. end tell
  41.  
  42. delay 2
  43.  
  44. tell application "System Events"
  45. tell process "System Preferences"
  46. set ServerAddrForm to text field "サーバアドレス:" of group 1 of window "ネットワーク"
  47. set AccountNameForm to text field "アカウント名:" of group 1 of window "ネットワーク"
  48.  
  49. activate
  50. set value of ServerAddrForm to VPCADDR
  51. set value of AccountNameForm to ACCOUNTNAME
  52.  
  53. click button "認証設定..." of group 1 of window "ネットワーク"
  54.  
  55. delay 2
  56.  
  57. set PasswordForm to text field "パスワード:" of sheet 1 of window "ネットワーク"
  58. set PSKForm to text field "共有シークレット:" of sheet 1 of window "ネットワーク"
  59.  
  60. activate
  61. set value of PasswordForm to PASSWD
  62. set value of PSKForm to psk
  63.  
  64. click button "OK" of sheet 1 of window "ネットワーク"
  65.  
  66. delay 2
  67.  
  68. activate
  69. set vpnstatus to checkbox "メニューバーに VPN の状況を表示" of group 1 of window "ネットワーク"
  70. if (value of vpnstatus) = 0 then
  71. click vpnstatus
  72. end if
  73. end tell
  74. end tell
  75.  
  76. delay 2
  77.  
  78. tell application "System Events"
  79. tell process "System Preferences"
  80. click button "適用" of window "ネットワーク"
  81. delay 1
  82. click button "接続" of group 1 of window "ネットワーク"
  83. end tell
  84. end tell
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement