View Full Version : Applescript application not working within Automator

Aug 3, 2012, 06:41 PM
Hi guys, I'm really new to Applescripting and I wanted to download and tweak some scripts from the web. The following script I downloaded creates an Ad-hoc network with a password for me.

property CreateMenuName : "Create Network…"
property NetworkName : "Network"
property NetworkPassword : "12345"

tell application "System Events"
tell process "SystemUIServer"
tell menu bar 1
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 is "Airport Menu Extra" then exit repeat
end repeat
tell menu bar item the_menu
perform action "AXPress"
delay 5
perform action "AXPress" of menu item CreateMenuName of menu 1
end tell
end tell
repeat until exists window 1
delay 5
end repeat
tell window 1
click checkbox 1
click pop up button 2
click menu item 1 of menu 1 of pop up button 2
set value of text field 2 to NetworkPassword
set value of text field 3 to NetworkPassword
set value of text field 1 to NetworkName
click button 1
end tell
end tell
end tell

It works great as a standalone script and as a run only application, but when I use the Launch Application command in Automator I receive an error and the script tries to run in a continuous loop.

Is there anything I should change with the script or is this an automator issue?

I'm running OSX 10.6.8