I am using an applescript to activate internet sharing option from 'System Pref> Sharing'. I work on MacOs 10.9.4. I found this script on a forum and am using it. This works fine, when the System Preferences window is open. However,when the System Preferences window is closed, the script opens the System Prefs window and then displays this error message:
System Events got an error: Can’t get menu item \"Sharing\" of menu \"View\" of menu bar 1 of process \"System Preferences\"." number -1728 from menu item "Sharing" of menu "View" of menu bar 1 of process "System Preferences"
This is the code for the script
tell application "System Preferences" activate end tell tell application "System Events" activate tell process "System Preferences" click menu item "Sharing" of menu "View" of menu bar 1 delay 2 tell window "Sharing"... //code after this
I am not proficient in AppleScript ,but only need to use this one to get a keyboard shortcut for toggling internet sharing. Also, the forum I got it from says the other users are able to use the script. I wonder if it has something to do with MAcOs 10.9