I want to get to-do's moved around between areas and lists and have been trying with applescript, but so far without luck.
For example: I'm using the time sector system, so when I drag a todo from Today to Next Week area, I want it to automatically be set to 'Anytime' (so moved to the 'Anytime' list) so it's removed from my daily list.
Also, I have some repeating items. Once they appear in my Today list, I want them to move away from the 'admin-repeated' area and into the 'admin' area.
What I've tried so far is this:
tell application "Things3"
set theTodos to to dos of list "Today"
repeat with aTodo in theTodos
if area is "TestArea" then
move to list "Anytime"
end if
end repeat
end tell
Not a Things user -- but you don't need to set theToDos then iterate through that, you can do it directly from the list. And in your loop you have to tell AS what object to test and move. Try:
tell application "Things3"
repeat with aToDo in to dos of list "Today"
if area of aToDo is "TestArea" then
move aToDo to list "Anytime"
end if
end repeat
end tell
Thanks for your input, Nige. Unfortunately this didn't solve it. I don't get any error message, but nothing happens.
I'm new to AppleScript, so I'm probably missing something rather basic, but I tried to look here for a solution Using AppleScript - Things Support without luck.
Start here, which is where I grabbed bits of the code above.
But you'll probably find you're approaching things are "upside down" -- object-based systems often work opposite to how we think of them and I'm guessing that while a to do is in an area it doesn't have an area property you can query. Instead, you ask the area about the to dos it contains.
This code snippet from the above link appears to back that up:
tell application "Things3"
repeat with ccToDo in to dos of area "Cultured Code"
--- do something with each to do using ccToDo variable
end repeat
end tell
So the question will be do you need to filter on both the "Today" listand the "TestArea" area, or is area alone enough? If it is then:
tell application "Things3"
repeat with aToDo in to dos of area "TestArea"
move aToDo to list "Anytime"
end repeat
end tell
Yes, the thing is I need to filter by both. The items affected should be in both the correct Area and the correct List. I could theoretically start from the Area and filter based on List, but I don't get that to work either.
That looks promising. Even better, I remembered this morning that my ex boss played with Things3 for a while and, sure enough, it's still around. So:
tell application "Things3"
set areaID to id of item 1 of (get every area whose name is "TestArea")
set theList to every to do of list "Today"
repeat with aToDo in theList
if area of aToDo is area id areaID then
move aToDo to list "Anytime"
end if
end repeat
end tell
It reads pretty straightforward, but ask if you've questions.