Enable File Sharing through AppleScripts UI elements in System Preferences
tell application "System Preferences"
activate
reveal pane "Sharing"
tell application "System Events"
tell process "System Preferences"
click checkbox "File Sharing" of table "services" of scroll area 1 of tab group 1 of window "Sharing"
end tell
end tell
end tell
That brings the Sharing pane to focus, but then errors out and tells me the following:
System Events got an error: Can’t get tab group 1 of window "Sharing" of process "System Preferences". Invalid index.
I've tried every UI path I could find to get it to recognize the checkbox. I even downloaded and installed PreFab's UI Browser. It showed me a different path than the Accessibility Inspector did, but that wouldn't work either. It seems like no matter what path I put in, it can't find the checkbox!
I will also need (once I get this working) to find a way to have the Options button within the File Sharing section get pressed, but one thing at a time I guess...
Also, if anyone has any ideas on a simpler method of scripting this feature (e.g. Shell script, another AppleScript call, etc.), please let me know! Thanks for the help in advance!
Jesse
Message was edited by: wozwas
iMac 8,1, Mac OS X (10.6)