Skip to content

Instantly share code, notes, and snippets.

@chrismays
Created February 10, 2019 01:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrismays/443281d8b7d7a77e95af03a1a5af970f to your computer and use it in GitHub Desktop.
Save chrismays/443281d8b7d7a77e95af03a1a5af970f to your computer and use it in GitHub Desktop.
Add all items from the Things Logbook from yesterday to a Day One journal entry
set currentDate to date string of (current date)
set yesterday to date string of ((current date) - 1 * days)
set yesterdayLog to open for access POSIX file "/var/tmp/things.log" with write permission
write "Things Tasks Completed " & yesterday & "
" to yesterdayLog
tell application "Things3"
repeat with completedItem in to dos of list "Logbook"
set item_completed to completion date of completedItem
set item_date to date string of (item_completed)
if (item_date ≠ currentDate) and (item_date ≠ yesterday) then
exit repeat
end if
if item_date is yesterday then
set areaName to "Area"
set projectName to "Project"
set displayName to "Calculating"
if area of completedItem is not missing value then
set areaName to name of area of completedItem
set displayName to areaName
else
if project of completedItem is not missing value then
set projectName to name of project of completedItem
if area of project of completedItem is not missing value then
set areaName to name of area of project of completedItem
set displayName to areaName & " - " & projectName
else
set displayName to projectName
end if
end if
end if
set completionDate to completion date of completedItem
set completionTime to time string of completionDate
write displayName & " - " & name of completedItem & " - " & "Completed at " & completionTime & "
" to yesterdayLog
end if
end repeat
end tell
close access yesterdayLog
do shell script "/usr/local/bin/dayone2 new --journal Logbook < /var/tmp/things.log"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment