OmniFocus Automation Action: This will append the provided text to the end of the title of the currently selected task(s)
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
/*{ | |
"type": "action", | |
"targets": ["omnifocus"], | |
"author": "Rosemary Orchard", | |
"identifier": "com.rosemaryorchard.omnifocus.append-to-task-title", | |
"version": "1.0", | |
"description": "This action will append the provided text to the end of the title of the currently selected task(s).", | |
"label": "Append to Task Title", | |
"shortLabel": "Append to Task Title", | |
"image": "plus.rectangle.fill" | |
}*/ | |
(() => { | |
var action = new PlugIn.Action(function(selection, sender){ | |
// action code | |
// selection options: tasks, projects, folders, tags, allObjects | |
var textInputField = new Form.Field.String( | |
"textInput", | |
null, | |
null | |
) | |
var checkSwitchField1 = new Form.Field.Checkbox( | |
"shouldIncludeTimeStamp", | |
"Include date/time stamp", | |
true | |
) | |
var inputForm = new Form() | |
inputForm.addField(textInputField) | |
var formPrompt = "Enter text to append to note:" | |
var buttonTitle = "Continue" | |
var formPromise = inputForm.show(formPrompt,buttonTitle) | |
inputForm.validate = function(formObject){ | |
inputText = formObject.values['textInput'] | |
return ((!inputText)?false:true) | |
} | |
formPromise.then(function(formObject){ | |
var textValue = formObject.values['textInput'].trim() | |
selection.tasks.forEach(function(task){ | |
task.name = task.name + " " + textValue | |
}) | |
}) | |
formPromise.catch(function(err){ | |
console.error("form cancelled", err.message) | |
}) | |
}); | |
action.validate = function(selection, sender){ | |
// validation code | |
// selection options: tasks, projects, folders, tags, allObjects | |
return (selection.tasks.length >= 1) | |
}; | |
return action; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment