Plug-In: Clipboard Objects to Markdown Links Apple Vision Pro

This plug-in uses the Pasteboard class functions to convert the OmniFocus objects currently copied to the clipboard, into a series of markdown text links, replacing the current clipboard contents with the markdown text.

To use the plug-in, copy the target OmniFocus objects (folders, projects, tasks, or tags) to the clipboard and run the plug-in. The contents of the clipboard will be replaced with links to the objects in markdown format:

obects-to-markdown

Return to: OmniFocus Plug-In Collection

Clipboard Objects to Markdown Links
   

/*{ "type": "action", "targets": ["omnifocus"], "author": "Otto Automator", "identifier": "com.omni-automation.of.pasteboard-objects-to-markdown-links", "version": "1.2", "description": "This plug-in converts the OmniFocus objects currently copied to the clipboard, into a series of markdown text links, replacing the current clipboard contents with the markdown text.", "label": "Clipboard Objects to Markdown Links", "shortLabel": "Markdown Links", "image":"arrow.right.doc.on.clipboard" }*/ (() => { const action = new PlugIn.Action(function(selection, sender){ if (Pasteboard.general.hasURLs){ links = Pasteboard.general.URLs markdownText = "" linkCount = links.length - 1 links.forEach((link,index) => { linkStr = link.string id = linkStr.substring(linkStr.lastIndexOf('/') + 1) if (index === linkCount){ var endOfLine = "" } else { var endOfLine = "\n" } if(Folder.byIdentifier(id)){ fldr = Folder.byIdentifier(id) markdownLink = `[FOLDER: ${fldr.name}](${linkStr})` markdownText += markdownLink + endOfLine } else if (Tag.byIdentifier(id)){ tag = Tag.byIdentifier(id) markdownLink = `[TAG: ${tag.name}](${linkStr})` markdownText += markdownLink + endOfLine } else if (Project.byIdentifier(id)){ project = Project.byIdentifier(id) markdownLink = `[PROJECT: ${project.name}](${linkStr})` markdownText += markdownLink + endOfLine } else if (Task.byIdentifier(id)){ task = Task.byIdentifier(id) markdownLink = `[TASK: ${task.name}](${linkStr})` markdownText += markdownLink + endOfLine } else { console.warn("Unknown", linkStr) } }) console.log(markdownText) Pasteboard.general.string = markdownText new Alert("COMPLETED","Markdown is on the clipboard.").show() } else { alertTitle = "MISSING RESOURCE" alertMessage = "No OmniFocus objects have been copied to the clipboard." new Alert(alertTitle, alertMessage).show() } }); action.validate = function(selection, sender){ return true }; return action; })();