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
R
, I can't really reproduce your environment to test however I did run the script you posted, changing thelist
item to an appropriate target, and it ran fine from Terminal and usinglaunchd
with the script set as a Launch Agent. (I don't usecron
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. – user3439894 Sep 14 '16 at 15:29osascript
and copy and pasted the lines from a online source. I got some strange error messages like567: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 withlaunchd
and the GUILaunchControl
but this also doesn't create the ToDo entries. Thanks in advance. – drmariod Sep 15 '16 at 6:34Reminders
. Also when I start using this within my R script. Maybe this is missing in theLaunchd
way? But it didn't asked me? – drmariod Sep 15 '16 at 6:38