Updated Evening AppleScript for Things
Improving existing solutions is a slippery slope for automators. You might improve things in a way that continues to save time and improve outcomes. But you might also be spending time rearranging apps in your Mac’s Dock to save milliseconds of mouse movement, only to realize you could have just used Alfred all along.
In this post, I share an improved automation for dealing with recurring tasks in Things that I think falls firmly on the side of worthwhile.
Previous AppleScript
I previously shared a wonderful AppleScript I found for dealing with moving repeating tasks in Things tasks to the Evening section of the Today view. It has been an awesome improvement to my Things experience for years.
But I have always had a paper-cut about the fact that the script removed any reminders that are on the recurring tasks, which it moved to the Evening section. As a result, I would have an evening task to Journal, but I would never do it since I was not looking at Things in the evening.
I decided to take this problem to Claude, and we came up with a new AppleScript that not only moves tasks to the Evening section based on a tag but also assigns reminders to those tasks too!
New AppleScript
This new script still runs via Keyboard Maestro early each morning to sort all my tasks before I wake up. It looks for any task tagged with “evening” and moves that task to the This Evening section of my Today view in Things.
But, after the task is moved, the script also looks through the notes of the task to look for a reminder time. If it finds one, it will add a reminder to the task with the time it found. It also preserves any Deadlines you have assigned to tasks, ensuring due dates aren’t lost when moving items to evening.
Reminder Time Formatting
This was needed because neither of Things’ automation solutions can read reminder data for a task, but they can read its notes. Since this is for recurring tasks, I decided it would be worth it for me to add this reminder time data in the notes section of the relevant tasks to get reminders on my tasks.
To prevent accidental assignment of reminders to actions, I decided that a useable but unique format would be best. The format that the script looks for is:
Reminder: 19:00
When the script searches the notes of an evening task and finds “Reminder: ” it reads the next five characters and converts that to a time for the reminder, this means that the reminder time needs to be in 24-hour time format since the script is just looking for five characters (including the colon).
Your reminder time can be at any part of the note, so feel free to continue using your notes as you need. I like having URLs for Shortcuts in mine.
Code
Here is the code for this new version of the script I use. You will need to get your Things Authentication Token and replace the “YOUR_AUTHENTICATION_TOKEN_GOES_HERE” part of the code with your token, inside the quotes.
(*
This AppleScript moves tasks tagged with "evening" from the "Today" list to the "evening" section in Things 3.
- If the to-do contains a reminder time in its notes (formatted as "Reminder: HH:mm"), the script will apply that reminder time when moving the task to the evening.
- If no reminder time is found in the notes, the task will still be moved to the evening, but no specific reminder time will be applied.
How to use:
1. Tag tasks with "evening" to be moved to the evening section.
2. If you want a reminder, add a line in the notes of the task in the following format:
Reminder: HH:mm
(Example: "Reminder: 18:00" for 6:00 PM or "Reminder: 09:30" for 9:30 AM)
3. Run the script, and it will move the task to the evening and set the reminder time if specified.
Note: Tasks without the "Reminder" entry will still be moved to the evening without a reminder.
*)
tell application "Things3"
set theToken to "YOUR_AUTHENTICATION_TOKEN_GOES_HERE"
set theTodos to to dos of list "Today"
repeat with aTodo in theTodos
-- Store the original due date
set originalDueDate to missing value
try
set originalDueDate to due date of aTodo
end try
-- Read the notes of the task to extract the reminder time
set notesContent to notes of aTodo
set reminderTime to missing value
-- Find the reminder time in the format 'Reminder: HH:mm'
if notesContent contains "Reminder:" then
set textStart to offset of "Reminder:" in notesContent
set reminderString to (characters (textStart + 10) through (textStart + 14) of notesContent) as string
set reminderTime to reminderString -- Extract time (e.g., "18:00" for 6 PM)
end if
-- Use tags to determine if it's an evening task
set tagList to tags of aTodo
repeat with aTag in tagList
if (name of aTag as text) is "evening" then
-- If a reminder time is found, move the task to evening with the reminder
if reminderTime is not missing value then
set theUrl to "things:///update?auth-token=" & theToken & "&id=" & (id of aTodo as text) & "&when=evening@" & reminderTime
else
-- If no reminder is found, move to evening without a specific time
set theUrl to "things:///update?auth-token=" & theToken & "&id=" & (id of aTodo as text) & "&when=evening"
end if
open location theUrl
-- Reapply the original due date if it exists
if originalDueDate is not missing value then
set dueDateUrl to "things:///update?auth-token=" & theToken & "&id=" & (id of aTodo as text) & "&due=" & originalDueDate
open location dueDateUrl
end if
end if
end repeat
end repeat
end tell
Closure
I hope this script helps you have a better experience with Things and serves as an example of how automation can help customize and improve your experience with an app. Now that Things is giving me a reminder, my Evening Journaling habit is actually starting to develop; I hope this workflow has the same result for you.
Let me know in the comments about an improvement you made to your setup through customization or automation!
Leave a Reply
Want to join the discussion?Feel free to contribute!