×

Plug-In: Add FaceTime Task

This plug-in will create a new task with a TAP|CLICK FaceTime link in its notes. Optionally, you can choose the call to use FaceTime Audio.

On iOS devices the email keyboard will be automatically used for the email input.

add-facetime-task

Return to: OmniFocus Plug-In Collection

Add FaceTime Task
 

/*{ "type": "action", "targets": ["omnifocus"], "author": "Otto Automator", "identifier": "com.omni-automation.of.add-facetime-task", "version": "1.0", "description": "This plug-in will create a new task with a FaceTime call link in its notes.", "label": "Add FaceTime Task", "shortLabel": "FaceTime Task" }*/ (() => { var action = new PlugIn.Action(function(selection, sender){ // action code // selection options: tasks, projects, folders, tags, allObjects var callSymbol = "☎️" var textInputField01 = new Form.Field.String( "taskName", "Task Title", callSymbol + "︎ FaceTime " ) var textInputField02 = new Form.Field.String( "FaceTimeEmail", "eMail", null ) if (Device.current.iOS && !Device.current.iPad){ textInputField02.keyboardType = KeyboardType.EmailAddress } var checkSwitchField = new Form.Field.Checkbox( "isAudioCall", "FaceTime Audio", false ) var inputForm = new Form() inputForm.addField(textInputField01) inputForm.addField(textInputField02) inputForm.addField(checkSwitchField) var formPrompt = "Task title and eMail:" if (Device.current.iOS && !Device.current.iPad){ var formPrompt = "Title & eMail:" } 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['FaceTimeEmail'] if (!inputText) {return false} var isEmail = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(inputText) if(!isEmail){return false} return true } formPromise.then(function(formObject){ var taskName = formObject.values['taskName'] var textValue = formObject.values['FaceTimeEmail'] var isAudioCall = formObject.values['isAudioCall'] var schema = (isAudioCall) ? "facetime-audio" : "facetime" var callURLStr = schema + "://" + textValue var url = URL.fromString(callURLStr) var task = new Task(taskName) task.note = url.string 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; })();