Running AppleScripts via JumpCloud Commands fails with error:
2016-08-12 10:03:11.325 osascript[599:7580] CFPasteboardRef CFPasteboardCreate(CFAllocatorRef, CF StringRef) : failed to create global data
AppleScripts must be run as the user that is currently logged in.
There are two methods to satisfy the requirement
- Edit the command and change the 'Run as:' to the user that is currently logged on
- To make the script more portable, prefix the command to run as the user currently logged on; e.g.:
sudo -u $(stat -f "%Su" /dev/console) osascript -e 'set x to "x" say x'