Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save craigeley/6040083 to your computer and use it in GitHub Desktop.
Save craigeley/6040083 to your computer and use it in GitHub Desktop.
An applescript that looks for Reminders completed today and then pushes them to an entry in the Day One journal app.
--Log Completed Reminders to Day One
--by Craig Eley (@craigeley), based on scripts by Samantha Hilton and Nick Morris
--This script looks for Reminders that were completed today, then automatically sends them to a single Day One entry using the Day One [CLI Tool](http://dayoneapp.com/tools/).
--Schedule it to run at 11:55 every night using Lingon or launchd and forget about it
tell application "Reminders"
set output to ""
set output to output & "# Things done on " & date string of (current date) & linefeed
--Find entries completed today from a specific list
set mylist to "Housekeeping"
set hasOne to false
if (count of (reminders in list mylist whose completed is true)) > 0 then
set todoList to reminders in list mylist whose completed is true
repeat with itemNum from 1 to (count of (reminders in list mylist whose completed is true))
set reminderObj to item itemNum of todoList
set nameObj to name of reminderObj
set compDateObj to completion date of reminderObj
set timeStr to time string of compDateObj
if (compDateObj is not missing value) then
set dayInt to day of compDateObj
set monthInt to month of compDateObj as integer
set yearInt to year of compDateObj
if (dayInt = day of (current date) and monthInt = month of (current date) as integer and yearInt = year of (current date)) then
if hasOne is false then
set output to output & linefeed & "### " & mylist & linefeed
set hasOne to true
end if
set output to output & "• " & timeStr & " - " & nameObj & linefeed
end if
end if
end repeat
else
--set output to output & "No Reminders for Today"
end if
--For additional LISTS within Reminders, you can copy and paste the above section, changing "set mylist to LIST" for every LIST in your Reminders app
--The following section writes the entry to Day One
--The timestamp is meant to correlate with when you set the script to automatically run with Hazel or another such system
set dateStr to ((month of (current date) as string) & "/" & day of (current date) as string) & "/" & year of (current date) as string
set shellTxt to "echo \"" & output & "\" | /usr/local/bin/dayone -d=\"" & dateStr & " " & "11:55PM" & "\"./dayone new"
do shell script shellTxt
end tell
@hepcat72
Copy link

hepcat72 commented Feb 4, 2020

BTW, I created the following script, using yours as a starting point:

https://gist.github.com/hepcat72/476652c48547cae0972f157bac35f50a

@jusup0
Copy link

jusup0 commented May 29, 2020

Is there a way to extract the image attached to the reminder?
I’d like to be able to save the image in an specific folder.

@amelchi
Copy link

amelchi commented May 2, 2023

does this still works? Ventura...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment