3

I have an applescript running beautifully in Script Editor as well as from an osascript command at the Terminal. The script talks to the Reminders.app in order to pass iCloud reminder entries to a few parsing scripts on my mac.

But when I try to launchd it, a few errors pop up in the system log:

Aug 11 16:43:07 machinename osascript[19678]: Performance: Please update this scripting addition to supply a value for ThreadSafe for each event handler: "/Library/ScriptingAdditions/FITS.osax"
Aug 11 16:43:07 machinename osascript[19678]: Performance: Please update this scripting addition to supply a value for ThreadSafe for each event handler: "/Library/ScriptingAdditions/SIMBL.osax"
Aug 11 16:43:07 machinename tccd[3421]: Unable to prompt for client without display name (osascript)
Aug 11 16:43:07 machinename Reminders[18838]: Error: Event Not Permitted for command Intrinsics.get
    Direct Parameter: <NSPropertySpecifier: scriptingReminders of scriptingLists named "Today" of scriptingAccounts named "iCloud">
    Receivers: <NSPropertySpecifier: scriptingReminders of scriptingLists named "Today" of scriptingAccounts named "iCloud">
    Arguments:     {
    }
Aug 11 16:43:07 machinename com.apple.xpc.launchd[1] (local.reminders.taskpaper.sync[19678]): Service exited with abnormal code: 1

The SIMBL Performance error I believe to be harmless -- this is a known issue.

I am assuming likewise for the FITS error.

But I need some help resolving the tccd and Reminders errors.... It sounds to me like I simply need to somehow provide extra permissions if the script is going to be run via launchd.

Here's the plist file, too, if it helps:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>
        <key>Label</key>
            <string>local.reminders.taskpaper.sync</string>
        <key>ProgramArguments</key>
            <array>
                <string>osascript</string>
                <string>/Users/eck/Library/Scripts/reminders_to_taskpaper.scpt</string>
            </array>
        <key>StartInterval</key>
            <integer>600</integer>
    </dict>
</plist>
  • 1
    In your System Preferences under Security & Privacy, what do you show under Accessibility for apps allowed to control your computer? May find an answer there. – bjbk Aug 12 '15 at 1:19
  • 1
    @bjbk: good idea! Indeed others have gotten osascript and other shell scripts into the assistive access list, though this involves "hacking" its sqlite3 database (see here and here if your are interested). Towards that aim, I'm still working on connecting to the db file. A few possibilities for that... – courtyardz Aug 12 '15 at 3:21
2

As bjbk commented, the problem was that osascript did not have Assistive Access. While it is easy to add .app programs to this list (System Preferences > Security & Privacy > Accessibility), OS X doesn't allow binaries to be added through the GUI. See Jacob Palmela's blog for how to add a program via the command line, or just copy and paste the following command, substituting in the path of the program to be added where indicated before executing:

sudo sqlite3 /Library/Application\ Support/com.apple.TCC/TCC.db "INSERT or REPLACE INTO access VALUES('kTCCServiceAccessibility','PROGRAM-TO-BE-ADDED',1,1,1,NULL)"

sudo is necessary because the sqlite3 db file is owned by root.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .