Hello all,
A little while back I posted a script that I pieced together for creating an ad-hoc network between my MBP and iOS devices. I’m using it in an automator workflow to change my settings and open my music programs. I’ve get it working pretty well except that for some reason every time the ad-hoc script runs the first time, i’m asked to enter my admin password. While this isn’t the end of the world and i’ve got a built in pause that prevents an error from occurring while I enter the pass, i’d like to figure out why it is happening and try to build in a fix in the script itself. I’m very new to this and have managed to learn enough about scripting to puzzle together this script from other’s work and older scripts. I gather something about shell scripts but haven’t had the time to figure out what it all means. Any help would be appreciated. Thank you all in advance…
here’s the script…
property NetworkName : "Network Name"
property NetworkPassword : "Thirteenchara"
property BringupScript : ""
tell application "System Events"
tell process "SystemUIServer"
tell menu bar 1
-- Find Airport Menu
set menu_extras to value of attribute "AXDescription" of menu bar items
repeat with the_menu from 1 to the count of menu_extras
if item the_menu of menu_extras contains "Wi-Fi" then exit repeat
end repeat
-- Turn on airport and start create network
tell menu bar item the_menu
perform action "AXPress"
-- If Wi-Fi is off, turn it on
if title of menu item 2 of menu 1 is "Turn Wi-Fi On" then
perform action "AXPress" of menu item "Turn Wi-Fi On" of menu 1
perform action "AXPress"
end if
perform action "AXPress" of menu item "Create Network." of menu 1
end tell
end tell
-- Enter information into Create Network Dialog
tell window 1
click pop up button 2
click menu item 4 of menu 1 of pop up button 2
set value of text field 3 to NetworkPassword
set value of text field 2 to NetworkPassword
set value of text field 1 to NetworkName
click button "Create"
end tell
end tell
end tell