Skip to content

Instantly share code, notes, and snippets.

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 thespacedoctor/1ba31c9505d5434ff6964942e2f2783b to your computer and use it in GitHub Desktop.
Save thespacedoctor/1ba31c9505d5434ff6964942e2f2783b to your computer and use it in GitHub Desktop.
[Open each active project in Things app in a new window - for review] #things #applescript #project
tell application "Things3"
-- MAKE SURE EVERY PROJECT HAS AT LEAST ONE TASK, OTHERWISE PROCEEDING ACTIONS WON'T FIND THE PROJECTS WITH 0 TASKs
repeat with pr in projects
if status of pr is open then
set thisCount to count of to dos of pr
if thisCount is 0 then
tell pr to make new to do with properties {name:"delete me"}
end if
end if
end repeat
-- NEED TO FILTER BY TODOS AS LISTS DON'T CONTAIN PROJECTS OBJECTS
set todos to to dos of list "Anytime"
-- MAKE SURE WE ONLY OPEN PROJECTS ONCE
set lastProject to ""
repeat with t in todos
-- INSPECT THE TODOS PROJECT, HAVE WE SEEN IT BEFORE, DOES IT MATCH OUR CRITERIA?
set p to project of t
if p is not missing value and name of p is not lastProject then
set a to area of p
if a is not missing value then
log name of a as string
end if
log name of p as string
tell application "System Events" to tell process "Things"
click menu item "New Things Window" of menu 1 of menu bar item "File" of menu bar 1
end tell
show p
set lastProject to name of p as string
if name of t is "delete me" then
delete t
end if
end if
end repeat
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment