Using a Stream Deck to Control Things

A close-up of a Stream Deck device and part of a keyboard on a wooden desk. The Stream Deck, with 15 programmable buttons, displays various icons and labels, including "Home," "Someday," "Saturday," "Tomorrow," and "Complete." The keyboard, partially visible, features standard keys, including "esc," "tab," "caps lock," and "shift." The scene suggests a workspace setup for productivity or content creation.

I made a YouTube video showing you how I am using a Stream Deck, along with some AppleScripts in Keyboard Maestro, to improve my control of Things. Check out the video and find all of the resources in this post.

Video

AppleScripts From the Video

If you are interested in implementing a similar workflow to what I shared in the video, I have assembled the scripts and tools I shared in this video.

KM Link

In the video, I failed to point out that I am using the Stream Deck plug-in “KM Link” to connect a Stream Deck button with a Keyboard Maestro macro. I Find KM Link to be much better than the official Keyboard Maestro plug-in.

If you want to run AppleScripts via a StreamDeck and Keyboard Maestro, you will want to install the free KM Link plug-in.

Move to Monday

This AppleScript will calculate the next Monday after today and then assign that date as the When date to the selected item in Things. I added some extra comments to the code from what you see in the video, but it is the same script.

(*
Things 3 "Schedule Tasks to Next Monday" Script (Silent Version)
Version: 1.1
Last Updated: 2024-10-04

Description:
This AppleScript is designed to work with the Things 3 task management application.
It schedules selected tasks to the next Monday while preserving reminders.

Functionality:
1. Calculates the date of the next Monday.
2. Schedules all selected tasks to that date.
3. Preserves existing reminders for each task.

Usage:
1. Select one or more tasks in Things 3.
2. Run this script.
3. Selected tasks will be scheduled for next Monday.

Note: This script requires Things 3 to be installed and running on your Mac.
*)

tell application "Things3"
	-- Calculate the next Monday
	set today to current date
	set dayOfWeek to weekday of today
	set daysToAdd to (9 - (dayOfWeek as integer)) mod 7
	if daysToAdd is 0 then set daysToAdd to 7
	set nextMonday to today + (daysToAdd * days)
	
	-- Get selected to-dos
	set selectedToDos to selected to dos
	
	-- Schedule selected to-dos to next Monday
	repeat with selectedToDo in selectedToDos
		-- Store the current reminder if it exists
		try
			set currentReminder to reminder of selectedToDo
		on error
			set currentReminder to missing value
		end try
		
		-- Schedule the to-do for next Monday
		schedule selectedToDo for nextMonday
		
		-- Restore the reminder if it existed
		if currentReminder is not missing value then
			set reminder of selectedToDo to currentReminder
		end if
	end repeat
end tell

Move to Saturday

This AppleScript will calculate the next Monday after today and then assign that date as the When date to the selected item in Things. I added some extra comments to the code from what you see in the video, but it is the same script.

(*
Things 3 "Schedule Tasks to Next Saturday" Script (Silent Version)
Version: 1.0
Last Updated: 2024-10-04

Description:
This AppleScript is designed to work with the Things 3 task management application.
It schedules selected tasks to the next Saturday while preserving reminders.

Functionality:
1. Calculates the date of the next Saturday.
2. Schedules all selected tasks to that date.
3. Preserves existing reminders for each task.

Usage:
1. Select one or more tasks in Things 3.
2. Run this script.
3. Selected tasks will be scheduled for next Saturday.

Note: This script requires Things 3 to be installed and running on your Mac.
*)

tell application "Things3"
	-- Calculate the next Saturday
	set today to current date
	set dayOfWeek to weekday of today
	set daysToAdd to (7 - (dayOfWeek - Saturday)) mod 7
	if daysToAdd is 0 then set daysToAdd to 7
	set nextSaturday to today + (daysToAdd * days)
	
	-- Get selected to-dos
	set selectedToDos to selected to dos
	
	-- Schedule selected to-dos to next Saturday
	repeat with selectedToDo in selectedToDos
		-- Store the current reminder if it exists
		try
			set currentReminder to reminder of selectedToDo
		on error
			set currentReminder to missing value
		end try
		
		-- Schedule the to-do for next Saturday
		schedule selectedToDo for nextSaturday
		
		-- Restore the reminder if it existed
		if currentReminder is not missing value then
			set reminder of selectedToDo to currentReminder
		end if
	end repeat
end tell

Move to Area

This AppleScript will move your selected action item to a predefined area in Things and assign an associated tag. In this case, the area is “🏥 Work”, and the tag is “work”. You will need to edit this code to match your setup by replacing the defined area and tag.

I added some extra comments to the code from what you see in the video, but it is the same script.

(*
Things 3 "Move to Work Area and Tag" Script
Version: 1.0
Last Updated: 2024-10-04

Description:
This AppleScript is designed to work with the Things 3 task management application.
It moves selected tasks to a specific "Work" area and adds a "work" tag if not already present.

Functionality:
1. Processes all currently selected task(s) in Things 3.
2. For each selected task, it:
   a. Moves the task to the "🏥 Work" area.
   b. Adds the "work" tag if it's not already present.

Usage:
1. Select one or more tasks in Things 3.
2. Run this script.
3. The selected tasks will be moved to the Work area and tagged appropriately.

Note: This script requires Things 3 to be installed and running on your Mac.
*)

tell application "Things3"
	-- Define the target area and tag
	set targetArea to first area whose name is "🏥 Work"
	set theTag to "work"
	
	-- Get selected to-dos
	set selectedToDos to selected to dos
	
	-- Check if any to-dos are selected
	if (count of selectedToDos) is 0 then
		display dialog "No tasks selected. Please select at least one task in Things 3." buttons {"OK"} default button "OK" with icon stop
		return
	end if
	
	-- Process each selected to-do
	repeat with selectedToDo in selectedToDos
		-- Move the to-do to the target area
		set area of selectedToDo to targetArea
		
		-- Add the tag if not already present
		set theTags to tag names of selectedToDo
		if theTags does not contain theTag then
			if theTags is "" then
				set tag names of selectedToDo to theTag
			else
				set tag names of selectedToDo to theTags & ", " & theTag
			end if
		end if
	end repeat
end tell

Make a Frog

This AppleScript will assign a When date of tomorrow your selected action item, prefix a 🐸 emoji to the action item’s title, and assign a “frog” tag.

The “frog” tag will have to already exist in Things, this script can not create a new tag for you.

I added some extra comments to the code from what you see in the video, but it is the same script.

(*
Things 3 "Frog Tasks for Tomorrow" Script (Multi-Select Version)
Version: 1.0
Last Updated: 2024-10-04

Description:
This AppleScript is designed to work with the Things 3 task management application.
It adds a frog emoji to the task name, adds a "frog" tag, and schedules the task for tomorrow.
This version supports processing multiple selected tasks at once.

Functionality:
1. Adds a frog emoji (🐸) to the beginning of each selected task name.
2. Adds a "frog" tag to each selected task if it doesn't already have it.
3. Schedules each selected task for tomorrow.
4. Preserves existing reminders for each task.

Usage:
1. Select one or more tasks in Things 3.
2. Run this script.
3. All selected tasks will be modified and scheduled for tomorrow.

Note: This script requires Things 3 to be installed and running on your Mac.
*)

tell application "Things3"
	set tomorrow to (current date) + 1 * days
	set selectedToDos to selected to dos
	
	repeat with selectedToDo in selectedToDos
		-- Store the current reminder if it exists
		try
			set currentReminder to reminder of selectedToDo
		on error
			set currentReminder to missing value
		end try
		
		-- Add frog emoji to the title if it's not already there
		if name of selectedToDo does not start with "🐸 " then
			set name of selectedToDo to "🐸 " & name of selectedToDo
		end if
		
		-- Add the frog tag
		set currentTags to tag names of selectedToDo
		if currentTags does not contain "frog" then
			if currentTags is "" then
				set tag names of selectedToDo to "frog"
			else
				set tag names of selectedToDo to currentTags & ", frog"
			end if
		end if
		
		-- Set the When date to tomorrow
		schedule selectedToDo for tomorrow
		
		-- Restore the reminder if it existed
		if currentReminder is not missing value then
			set reminder of selectedToDo to currentReminder
		end if
	end repeat
end tell

Clear to Neutral

You can read more about my Clear to Neutral process by checking out this blog post. It is essentially a daily review process that helps me create some closure to the workday and helps me prepare for tomorrow.

This write-up is from my days as a teacher, so the specific elements are different for me now, but the general idea is the same.

Tag Maintenance in Things Blog Post

If you are interested in more tag-centric automation for Things, I have another blog post where I share an AppleScript for maintaining tags in Things.

This script helps cover circumstances where I did not use the “Move to _” scripts on my Stream Deck and a few other situations.

Closure

I hope these resources have helped you; please let me know in the comments if they did or if there is something I should consider adding to my workflow!

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.