cielavenir

adhoc.applescript

Dec 5th, 2012
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. property NetworkName : "iPhone"
  2. --property NetworkPassword : "1234567890123"
  3.  
  4. property CreateMenuName : "ネットワークを作成..."
  5.  
  6. #try
  7. #   do shell script "/usr/sbin/scselect " & NetworkName
  8. #   delay 2
  9. #end try
  10.  
  11. tell application "System Events"
  12.     tell process "SystemUIServer"
  13.         tell menu bar 1
  14.             set menu_extras to value of attribute "AXDescription" of menu bar items
  15.             repeat with the_menu from 1 to the count of menu_extras
  16.                 if item the_menu of menu_extras begins with "Wi-Fi" then exit repeat
  17.             end repeat
  18.             tell menu bar item the_menu
  19.                 perform action "AXPress"
  20.                 delay 0.2
  21.                 perform action "AXPress" of menu item CreateMenuName of menu 1
  22.             end tell
  23.         end tell
  24.         repeat until exists window 1
  25.             delay 0.5
  26.         end repeat
  27.         tell window 1
  28.             keystroke NetworkName
  29.             --click checkbox 1
  30.             --keystroke NetworkPassword
  31.             keystroke tab
  32.             --keystroke NetworkPassword
  33.             click pop up button 2
  34.             click menu item 2 of menu 1 of pop up button 2
  35.             delay 0.5
  36.            
  37.             click button 1
  38.         end tell
  39.     end tell
  40. end tell
Advertisement
Add Comment
Please, Sign In to add comment