Last active
August 29, 2015 14:21
-
-
Save gbcosgrove/d84ec4e53feacc56e1a5 to your computer and use it in GitHub Desktop.
Batch Append Notes in Omnifocus 2
This file contains 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
JsOsaDAS1.001.00bplist00ÑVscript_8/** | |
* | |
* | |
* @author Greg Cosgrove | |
* Special thanks to Brandon Pittman whose OmniFocusLibrary.js I used as a template for this script | |
*/ | |
var app = Application('omnifocus'); | |
app.includeStandardAdditions = true; | |
var current = Application.currentApplication(); | |
current.includeStandardAdditions = true; | |
var doc = app.defaultDocument; | |
function selected() { | |
return app.windows[0].content.selectedTrees.value(); | |
} | |
function appendNote(tasks, tags) { | |
tasks.forEach(function(task) { | |
var oldTags = task.note(); | |
task.note = oldTags + " " + tags; | |
}) | |
alert("Success!"); | |
} | |
function alert(text, informationalText) { | |
var options = { } | |
if (informationalText) options.message = informationalText | |
app.displayAlert(text, options) | |
} | |
function prompt(text, defaultAnswer) { | |
var options = { defaultAnswer: defaultAnswer || '' } | |
try { | |
return app.displayDialog(text, options).textReturned | |
} catch (e) { | |
return null | |
} | |
} | |
var targetTasks = selected(); | |
var newTags = prompt("What Tags?", "") | |
appendNote(targetTasks, newTags); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment