Another quick script, to get my top reminders in front of me.
(iTunes script; fuzzy clock script)
Obviously everyone has different ways of managing todos, generally I only have the most important things to act upon in the reminders app. As the touchbar can only accommodate two lines, if you have more than a few dozen todos especially across multiple lists, you may want to specify the name of a list, and only put the important todos in that one list. I also haven't yet added logic to select the next scheduled todo by time, so if you've many scheduled at different times during the day this won't be very helpful.
Recommended settings: font-size 12, black background; execute every 100 secs. I also use slightly pink text colour to differentiate and attract attention from other text down there. Polling the Reminders app seems to be very slow, so I've set it to only update every 30 mins, the disadvantage of which is naturally that once completed a todo won't disappear from your touchbar for a while. You could «set_number_variable "reminderCheck" to 0» somehow though. Also I delete my todos when completed to avoid a bloated DB. The emoji symbols don't line up terribly well, but you can always change them.
-- ▫️ unscheduled; 🔸 due today; 🔺 overdue (yesterday or older)
-- displays two reminders from all lists and preferring the highest priority; the first line prefers scheduled reminders (for today, before overdue ones) if any; the second line shows unscheduled reminders; scheduled reminders only check day (so you'll see the reminder in the morning even if scheduled for later); if multiple reminders match the one displayed is random as the reminders app does not provide its display order
set today to current date
tell application "BetterTouchTool"
if time of today is less than (get_number_variable "reminderCheck") then return
local time
set time to (time of today) + 1800 -- next check in 30 mins
if time is greater than 86400 then set time to time - 86400 -- next check tomorrow
set_number_variable "reminderCheck" to time
end tell
set hours of today to 23
set minutes of today to 59
set width to 36
set item1 to {rank:11, name:""}
set item2 to {rank:11, name:""}
set item3 to {rank:11, name:""}
tell application "Reminders"
-- iterating across all lists and reminders is extremely slow so we collect the incomplete ones in a single query then iterate which is significantly faster and not too expensive (except for returning every property) as there shouldn't be many incomplete
set theReminders to properties of every reminder whose completed is false -- every reminder of list "name" whose completed is false
end tell
using terms from application "Reminders"
local rank
repeat with theReminder in theReminders
tell theReminder
set rank to priority
if rank is 0 then set rank to 10 -- heaven knows why the default value for an unset priority is a lower integer than high priority which is 1, and low is 9
if due date is not missing value then
if due date is less than today then
if rank of item1 is 11 or day of due of item1 is not day of today or rank is less than rank of item1 then -- TODO: prefer the earliest occurring from today
set item1 to {rank:rank, name:name, due:due date}
end if
end if
else if rank of item1 is not 11 then
if rank is less than rank of item2 then
set item2 to {rank:rank, name:name}
end if
else if rank is less than rank of item2 then
set item3 to item2
set item2 to {rank:rank, name:name}
else if rank is less than rank of item3 then
set item3 to {rank:rank, name:name}
end if
end tell
end repeat
end using terms from
if length of name of item1 is greater than width then set name of item1 to text items 1 through width of name of item1 & "…"
if length of name of item2 is greater than width then set name of item2 to text items 1 through width of name of item2 & "…"
if length of name of item3 is greater than width then set name of item3 to text items 1 through width of name of item3 & "…"
set alert to {}
if rank of item1 is not 11 then
set hours of due of item1 to 23
set minutes of due of item1 to 59
if due of item1 is less than today then
-- overdue
copy "🔺 " to end of alert
else
copy "🔸 " to end of alert
end if
copy name of item1 to end of alert
copy "
" to end of alert
if rank of item2 is not 11 then
copy "▫️ " to end of alert
copy name of item2 to end of alert
end if
else if rank of item2 is not 11 then
copy "▫️ " to end of alert
copy name of item2 to end of alert
copy "
" to end of alert
if rank of item3 is not 11 then
copy "▫️ " to end of alert
copy name of item3 to end of alert
end if
end if
return alert as string