Last active
September 2, 2016 14:47
-
-
Save founddrama/57d04d7848ebebdaab763d0e4787502d to your computer and use it in GitHub Desktop.
prototype script to purge my Things Logbook of "known junk"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// replacing line 22 of Things-Logbook-Purge.js with... (and errors received) | |
todo.move(Trash); | |
// ^ Error on line 55: Error: Parameter is missing. | |
todo.move(todo, Trash); | |
// ^ Error on line 55: Error: Parameter is missing. | |
Things.move(todo, Trash); | |
// ^ Error on line 55: Error: Parameter is missing. | |
Things.move(todo, {to: Trash}); | |
// ^ Error on line 55: Error: Not expecting object specifier. Argument has object specifier. | |
todo.move({to: "FocusTrash"}); | |
// ^ Error on line 55: Error: Expected list but found string. | |
todo.move({to: List("FocusTrash")}); | |
// ^ Error on line 55: ReferenceError: Can't find variable: List | |
todo.move({to: Things.List("FocusTrash")}); | |
// ^ Error on line 55: Error: First parameter passed to List constructor must be an object | |
todo.move({to: Things.lists.byId("FocusTrash")}); | |
// ^ Error on line 55: Error: Not expecting object specifier. Argument has object specifier. | |
todo.move({to: Things.lists.byId("FocusTrash")()}); | |
// ^ Error on line 55: Error: Not expecting object specifier. Argument has object specifier. | |
todo.move({to: Things.lists["FocusTrash"]}); | |
// ^ Error on line 55: Error: Not expecting object specifier. Argument has object specifier. | |
todo.move({to: Things.lists["FocusTrash"]()}); | |
// ^ Error on line 55: Error: Can't get object. | |
todo.move({ to: Things.lists.whose({name: 'Trash'})() }); | |
// ^ Error on line 55: Error: Can't convert types. | |
todo.move({ to: Things.lists.whose({id: 'FocusTrash'})() }); | |
// ^ Error on line 55: Error: Can't convert types. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
disposableTodoNames = [ | |
"Clean out dishwasher filter", | |
"Clean out toaster crumb tray", | |
"Clean refrigerator", | |
"🐱Clean Cat Box" | |
]; | |
function isTrashable(todo) { | |
return disposableTodoNames.indexOf(todo.name()) > -1 || | |
(todo.area().name().indexOf('Shopping') > -1); | |
} | |
Things = Application('Things'); | |
Logbook = Things.lists().find(function(list) { return list.name() == "Logbook" }); | |
Trash = Things.lists().find(function(list) { return list.name() == "Trash" }); | |
logbookTodos = Logbook.toDos(); | |
logbookTodos.forEach(function(todo) { | |
if (isTrashable(todo)) { | |
todo.move({ to: Trash }); | |
// ^ Error on line 22: Error: Not expecting object specifier. Argument has object specifier. | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set the disposableTodoNames to {"Clean out dishwasher filter", "Clean out toaster crumb tray", "Clean refrigerator", "🐱Clean Cat Box"} | |
tell application "Things" | |
set logbookTodos to the to dos of list id "FocusLogbook" | |
repeat with todo in logbookTodos | |
if disposableTodoNames contains name of todo then | |
move todo to the list id "FocusTrash" | |
end if | |
end repeat | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment