Posted on 02-06-2014 05:21 PM
Hello - I am wondering why the following apple script works fine in 10.8.x via manual execution and through Self Service - but in 10.9 it only works when manually executed but not through a Self Service policy?
tell application "System Preferences"
reveal pane "Sharing"
activate
end tell
Any pointers?
Appreciate any help.
Solved! Go to Solution.
Posted on 02-11-2014 08:33 AM
10.9 did introduce more strict controls over what is allowed to manipulate the GUI. Instead of a global "Enable Access for Assistive Devices" checkbox, you now need to allow access per application.
There's another thread here that details how to programmatically write in the settings to allow a specific application access to that. But since you're talking about an Applescript, not an application, I'm not certain if that's what's going for you. It could be you need to give Self Service access to the assistive devices controls. but in the interim, I would try this syntax instead and see if it works.
tell application "System Preferences"
activate
set the current pane to pane id "com.apple.preferences.sharing"
end tell
Also consider wrapping it up in a shell script instead of a pure Applescript. You may have better luck getting it to run.
Posted on 02-06-2014 05:50 PM
My guess is "Self Service.app" has been denied access to accessibility services.
Posted on 02-11-2014 08:14 AM
The strange part is that I am not receiving a prompt to allow any apps (Self Service or AppleScript) access to Accessibility Services.... and other apple scripts (that don't interact with the UI) are working fine....
Posted on 02-11-2014 08:33 AM
10.9 did introduce more strict controls over what is allowed to manipulate the GUI. Instead of a global "Enable Access for Assistive Devices" checkbox, you now need to allow access per application.
There's another thread here that details how to programmatically write in the settings to allow a specific application access to that. But since you're talking about an Applescript, not an application, I'm not certain if that's what's going for you. It could be you need to give Self Service access to the assistive devices controls. but in the interim, I would try this syntax instead and see if it works.
tell application "System Preferences"
activate
set the current pane to pane id "com.apple.preferences.sharing"
end tell
Also consider wrapping it up in a shell script instead of a pure Applescript. You may have better luck getting it to run.
Posted on 02-11-2014 09:37 AM
@mm2270 I attempted your syntax, but had the same results - it triggers the system preferences, but does not activate the window or open the sharing pane. I am going to try wrapping it in a shell script to see if i get better results.
Posted on 02-11-2014 09:56 AM
If it doesn't work even after wrapping it into a shell script, then you may need to resort to doing the /bin/launchctl bsexec route. I've needed to do that with quite a few scripts going forward, as the OS is getting more strict about allowing applications to be launched as the user. So we need to run commands in the context of the user's space, or it gets blocked.
Posted on 02-11-2014 07:28 PM
I ended up dropping the applescript as a .app onto the local machine, then calling it via JSS - Execute Command:
/Library/Application Support/JAMF/Scripts/OpenSharingMavericks.app/Contents/MacOS/applet
Seems to be working well! Thanks for the recommendations, much appreciated.