2

I have a little shell script which creates a new reminder for a project. This works pretty fine and I can execute in the command line newCfSamples "my new sample" and the reminder gets created.

I now have a little R script, which figures out what samples are new and it should create a reminder for this. This script works fine as well and creates the Reminders.

Both together, so cron is starting my R script fails at the point when it is executing my little newCfSamples script with the following error message: execution error: Reminders got an error: An error of type -1743 has occurred. (-1743).

I then started my script directly with cron and this also fails. Here is the complete error message.

Subject: Cron <madejung@madejung-2> /Users/madejung/bin/newCfSamples test
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=madejung>
X-Cron-Env: <USER=madejung>
X-Cron-Env: <HOME=/Users/madejung>
Date: Wed, 14 Sep 2016 15:42:00 +0200 (CEST)

290:540: execution error: Reminders got an error: An error of type -1743 has occurred. (-1743)

Would be great if somebody would help me get this running.

My newCfSamples script looks like this:

#!/usr/bin/env bash                                                                                                               
# Make a new reminder via terminal script                                                                                         
# args: remind <title> <date> <time>                                                                                                                                                                                 
my_date=`date "+%d/%m/%Y"`
my_time='09:00'
osascript - "$1" "${my_date}" "${my_time}" <<END                                                                                                        
on run argv                                                                                                                       
    set stringedAll to date (item 2 of argv & " " & item 3 of argv)                                                               
    tell application "Reminders"                                                                                                  
        make new reminder in list "CF User Sample" with properties {name:item 1 of argv, due date:stringedAll}                                             
    end tell                                                                                                                      
end run                                                                                                                           
END
4
  • Since I don't do R, I can't really reproduce your environment to test however I did run the script you posted, changing the list item to an appropriate target, and it ran fine from Terminal and using launchd with the script set as a Launch Agent. (I don't use cron anymore as it's depreciated in OS X.) This is with the system logged in and not locked. BTW, What's will all the totally unnecessary white-space in your script? I'm talking about all the trailing space after 10 of the 13 lines of code as shown in this image. Commented Sep 14, 2016 at 15:29
  • Actually, I just started using the osascript and copy and pasted the lines from a online source. I got some strange error messages like 567:570: syntax error: Expected end of line, etc. but found command name. (-2741) so I thought the white space is correct :-) @user3439894 could you maybe provide your solution? I also tested it with launchd and the GUI LaunchControl but this also doesn't create the ToDo entries. Thanks in advance.
    – drmariod
    Commented Sep 15, 2016 at 6:34
  • @user3439894 maybe one more thing, when I executed my shell script, there was always a popup message asking for allowance to change Reminders. Also when I start using this within my R script. Maybe this is missing in the Launchd way? But it didn't asked me?
    – drmariod
    Commented Sep 15, 2016 at 6:38
  • Is there a way to always allow R to access Reminders? Today I got asked again. I am wondering if I will overlook this again?
    – drmariod
    Commented Sep 16, 2016 at 8:05

1 Answer 1

1

I think I found the solution. As I mentioned in the above comments, I am using the GUI LaunchControl, I started the job once by hand with the menu Job -> Start and I got a little popup if R is allowed to access Reminders. I clicked yes and now it is working.

It looks like, this popup couldn't be displayed so I could never allow it.

This is how the LaunchControl entry looks like

1

You must log in to answer this question.

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