×

Plug-In: Add Call Task

This plug-in will create a new task with a TAP|CLICK call link in its notes. Optionally, you can tag the task with the default Apple phone emoji tag: ☎️

On iOS devices the keypad will be automatically used for the phone number input.

add-call-task
Add Call Task
 

/*{ "type": "action", "targets": ["omnifocus"], "author": "Otto Automator", "identifier": "com.omni-automation.of-add-call-task", "version": "1.5", "description": "This plug-in will create a new task with a call link in its notes. Option to assign tag to new task.", "label": "Add Call Task", "shortLabel": "Call Task" }*/ (() => { var action = new PlugIn.Action(function(selection, sender){ // action code // selection options: tasks, projects, folders, tags, allObjects var titleEmoji = "☎️" var taskTitlePrefix = titleEmoji + "︎ Call " var textInputField01 = new Form.Field.String( "taskName", "Task Title", taskTitlePrefix ) var textInputField02 = new Form.Field.String( "callNumber", "[0 to 9, +, *, #]", null ) if (Device.current.iOS && !Device.current.iPad){ textInputField02.keyboardType = KeyboardType.PhonePad } var textInputField03 = new Form.Field.String( "tagName", "Tag task with:", null ) var inputForm = new Form() inputForm.addField(textInputField01) inputForm.addField(textInputField02) inputForm.addField(textInputField03) var formPrompt = "Task title and phone number:" if (Device.current.iOS && !Device.current.iPad){ var formPrompt = "Title & Number:" } var buttonTitle = "Continue" var formPromise = inputForm.show(formPrompt,buttonTitle) inputForm.validate = function(formObject){ var taskName = formObject.values['taskName'] if (!taskName) {return false} var inputText = formObject.values['callNumber'] if (!inputText) {return false} var isCall = /^[0-9,*,#,+]+$/i.test(inputText) return ((isCall && inputText.length >= 7)?true:false) } formPromise.then(function(formObject){ var taskName = formObject.values['taskName'] var textValue = formObject.values['callNumber'] var tagName = formObject.values['tagName'] if(tagName){ var result = flattenedTags.filter((tag) => tag.name === tagName)[0] var tagObj = ((result) ? result : new Tag(tagName)) } var callURLStr = "tel://" + textValue var url = URL.fromString(callURLStr) var task = new Task(taskName) task.note = url.string if(tagName){task.addTag(tagObj)} var id = task.id.primaryKey URL.fromString("omnifocus:///task/" + id).open() }) }); action.validate = function(selection, sender){ // validation code // selection options: tasks, projects, folders, tags, allObjects return true }; return action; })();

Return to: OmniFocus Plug-In Collection