OmniFocus: Markdown Link to Selected Item (template)
The actions of the following shortcut can be used to return a link in Markdown format to the currently selected project, task, tag, or folder. These actions can be copied and pasted into your shortcut.
This template works with Apple Notes, Apple Mail, Drafts, Bear, Craft, and other 3rd-party applications with integrated Shortcuts support that accept text as input.
Markdown Link of Selected Item
try {var sel = selection.databaseObjectsif(sel.length === 1){var selectedItem = sel[0]if (selectedItem instanceof Folder){var objType = "folder"} else if (selectedItem instanceof Tag){var objType = "tag"} else {var objType = "task"}} else {throw {name: "Selection Issue",message: "Please select a single task, project, folder, or tag."}}var ID = selectedItem.id.primaryKeyvar urlStr = `omnifocus:///${objType}/${ID}`var markdownLink = `[${selectedItem.name}](${urlStr})`markdownLink}catch(err){var alertPromise = new Alert(err.name, err.message).show()alertPromise.then(result => {throw new Error(-128)})}