Plug-In: Agenda Note for Selected Item Apple Vision Pro

DISCLAIMER: Mention of third-party websites and products is for informational purposes only and constitutes neither an endorsement nor a recommendation. OMNI-AUTOMATION.COM assumes no responsibility with regard to the selection, performance or use of information or products found at third-party websites. OMNI-AUTOMATION.COM provides this only as a convenience to our users. OMNI-AUTOMATION.COM has not tested the information found on these sites and makes no representations regarding its accuracy or reliability. There are risks inherent in the use of any information or products found on the Internet, and OMNI-AUTOMATION.COM assumes no responsibility in this regard. Please understand that a third-party site is independent from OMNI-AUTOMATION.COM and that OMNI-AUTOMATION.COM has no control over the content on that website. Please contact the vendor for additional information.

This plug-in creates a new Agenda note using the title, note, and due date of the selected project or task.

A link-back to the created Agenda item is prepended to the OmniFocus item’s note. And a link-back to the source OmniFocus item is prepended to the created Agenda item’s note. In addition, if the project or task has a due date, it is transfered to Agenda as well.

(NOTE: This plug-in requires OmniFocus 4.x)

TIP: The note field for projects and tasks in OmniFocus 4 supports RTF (Rich Text Format) which is used by Agenda when the “Copy As… Note Text” option is selected. So… you can copy and paste your Agenda note into the OmniFocus note field and retain its look and formatting!

Return to: OmniFocus Plug-In Collection

Agenda Note for Selected Item
   

/*{ "type": "action", "targets": ["omnifocus"], "author": "Otto Automator", "identifier": "com.omni-automation.of.new-agenda-item", "version": "1.3", "description": "Creates a new Agenda note using the title and note of the selected project or task. A link-back to the created Agenda item is prepended to the item’s note.", "label": "Agenda Note for Selected Item", "shortLabel": "Agenda Note", "paletteLabel": "Agenda Note", "image": "note.text.badge.plus" }*/ (() => { const action = new PlugIn.Action(async function(selection, sender){ // action code try { var item = selection.databaseObjects[0] // create the callback-url using data from selected project or task encodedTitle = encodeURIComponent(item.name) encodedNote = encodeURIComponent(item.note) itemLink = `[OmniFocus](omnifocus:///task/${item.id.primaryKey})` encodedLink = encodeURIComponent(itemLink) urlStr = "agenda://x-callback-url/create-note" urlStr += `?title=${encodedTitle}` urlStr += `&text=${encodedLink}%0A` urlStr += `${encodedNote}` // add due date if used if(item.dueDate){ fmtr = Formatter.Date.withFormat('yyyy-MM-dd') dateStr = fmtr.stringFromDate(item.dueDate) urlStr += `&date=${dateStr}` } // convert url string to URL object callingURL = URL.fromString(urlStr) // call the URL and use the response callingURL.call(function(noteID){ // use the returned note identifier to create link linkStr = `agenda://x-callback-url/open-note` linkStr += `?identifier=${noteID}` console.log(linkStr) linkURL = URL.fromString(linkStr) // prepend the link object to the item note noteObj = item.noteText linkURL = URL.fromString(linkStr) linkObj = new Text("(Agenda Link)", noteObj.style) newLineObj = new Text("\n", noteObj.style) style = linkObj.styleForRange(linkObj.range) style.set(Style.Attribute.Link, linkURL) noteObj.insert(noteObj.start, linkObj) noteObj.insert(linkObj.range.end, newLineObj) // reveal the note node = document.windows[0].content.selectedNodes[0] node.expandNote(false) }, function(err){ throw { name: "Script Error", message: err.errorMessage } }) } catch(err){ console.error(err.name, err.message) new Alert(err.name, err.message).show() } }); action.validate = function(selection, sender){ // validation code (single selected project or task) return ( selection.projects.length === 1 || selection.tasks.length === 1 ) }; return action; })();

Here’s a companion plug-in that will search Agenda using the name of the selected item.

Search Agenda for Item Name
   

/*{ "type": "action", "targets": ["omnifocus"], "author": "Otto Automator", "identifier": "com.omni-automation.of.search-agenda-for-item-name", "version": "1.0", "description": "Plug-in will perform in Agenda for the name of the selected project or task.", "label": "Search Agenda for Name", "shortLabel": "Search Agenda", "paletteLabel": "Search Agenda", "image": "doc.text.magnifyingglass" }*/ (() => { const action = new PlugIn.Action(async function(selection, sender){ // action code try { item = selection.databaseObjects[0] encodedTitle = encodeURIComponent(item.name) urlStr = `agenda://x-callback-url/open-search?query=${encodedTitle}` searchURL = URL.fromString(urlStr) searchURL.open() } catch(err){ console.error(err.name, err.message) new Alert(err.name, err.message).show() } }); action.validate = function(selection, sender){ // validation code return (selection.projects.length === 1 || selection.tasks.length === 1) }; return action; })();