Here's the script. It's purpose is to create an ad-hoc wifi network on Mavericks 10.9.5. It fails because the final "Create" button remains greyed-out and can't be pressed by the script.
The delays are present only so that I could see what was happening while the script ran. I realise that specifying the precise menu bar item location is fragile but it works in my case. You will probably have to adjust this if you want to test this script yourself. Count the menu bar items from left to right, and ignore 3rd-party menu bar items.
I've commented out the final, problematic "click button 1" command. Everything up to this point works just fine. One of the last things the script does is enter the passwords for the network. However, despite both passwords being entered and both obviously matching, the "Create" button remains greyed out. If you select either password field after the script has run, delete the last letter and then enter it manually, ie. delete the "r" from "bar", and then re-enter it, the button becomes active.
Anyone know what's causing this, and how to get round it?
Code:
property CreateMenuName : "Create Network
"
property NetworkName : "foo"
property NetworkPassword : "bar"
property WifiType : "128-bit WEP"
tell application "System Events"
tell process "SystemUIServer"
tell menu bar item 4 of menu bar 1
click
click menu item CreateMenuName of menu 1
end tell
tell window 1
click pop up button 2
click menu item WifiType of menu 1 of pop up button 2
set value of text field 2 to NetworkPassword
delay 1
set value of text field 3 to NetworkPassword
delay 1
set value of text field 1 to NetworkName
delay 1
(*click button 1*)
end tell
end tell
end tell
The delays are present only so that I could see what was happening while the script ran. I realise that specifying the precise menu bar item location is fragile but it works in my case. You will probably have to adjust this if you want to test this script yourself. Count the menu bar items from left to right, and ignore 3rd-party menu bar items.
I've commented out the final, problematic "click button 1" command. Everything up to this point works just fine. One of the last things the script does is enter the passwords for the network. However, despite both passwords being entered and both obviously matching, the "Create" button remains greyed out. If you select either password field after the script has run, delete the last letter and then enter it manually, ie. delete the "r" from "bar", and then re-enter it, the button becomes active.
Anyone know what's causing this, and how to get round it?