Search Craft for Title of Selected Item
Initiate a search in the Craft app for the title of the selected project or task.
Return to: OmniFocus Plug-In Collection
Search Craft for Title of Selected Item
/*{
"type": "action",
"targets": ["omnifocus"],
"author": "Otto Automator",
"identifier": "com.omni-automation.of.search-craft-for-item",
"version": "1.1",
"description": "Will initiate a search in the Craft app for the title of the selected project or task.",
"label": "Search Craft for Selected Item",
"shortLabel": "Search Craft",
"paletteLabel": "Search Craft",
"image": "magnifyingglass.circle"
}*/
(() => {
var action = new PlugIn.Action(function(selection, sender){
// action code
// tasks | projects | folders | tags | databaseObjects | allObjects
if (selection.projects.length === 1){
selectedItem = selection.projects[0]
} else {
selectedItem = selection.tasks[0]
}
encodedTitle = encodeURIComponent(selectedItem.name)
urlStr = `craftdocs://openSearch?spaceId=&query=${encodedTitle}`
URL.fromString(urlStr).open()
});
action.validate = function(selection, sender){
// validation code
// tasks | projects | folders | tags | databaseObjects | allObjects
return (selection.tasks.length === 1 || selection.projects.length === 1)
};
return action;
})();