Last active
May 2, 2023 17:13
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
does this still works? Ventura...