Outline Item to OmniFocus Task
									
			Those who rely upon computing devices firmly believe that data must be able to be quickly shared between applications and devices. Fortunately, Omni Automation provides a user-enabled mechanism to conveniently move information between apps, such as creating a new OmniFocus task using the information in the selected OmniOutliner item.
			
			Here’s an Omni Automation script for extracting the data from the selected outline row (topic and note) and using it to create a new task in OmniFocus. The script uses the integrated URL support in OmniFocus  to create and run a URL link for creating tasks:
			
			items = document.editors[0].selection.items
if (items.length === 1){
	try{taskName = items[0].topic} catch(err){taskName = ''}
	try{taskNote = items[0].note} catch(err){taskNote = ''}
	if(taskName != ''){
		taskName = encodeURIComponent(taskName)
		urlStr = "omnifocus://localhost/add?name=" + taskName
		if (taskNote != ''){
			taskNote = encodeURIComponent(taskNote)
			urlStr = urlStr + "&" + "note=" + taskNote
		}
		URL.fromString(urlStr).open()
	}
}
			omnioutliner://localhost/omnijs-run?script=try%7Bitems%20%3D%20document%2Eeditors%5B0%5D%2Eselection%2Eitems%0Aif%20%28items%2Elength%20%3D%3D%3D%201%29%7B%0A%09try%7BtaskName%20%3D%20items%5B0%5D%2Etopic%7D%20catch%28err%29%7BtaskName%20%3D%20%27%27%7D%0A%09try%7BtaskNote%20%3D%20items%5B0%5D%2Enote%7D%20catch%28err%29%7BtaskNote%20%3D%20%27%27%7D%0A%09if%28taskName%20%21%3D%20%27%27%29%7B%0A%09%09taskName%20%3D%20encodeURIComponent%28taskName%29%0A%09%09urlStr%20%3D%20%22omnifocus%3A%2F%2Flocalhost%2Fadd%3Fname%3D%22%20%2B%20taskName%0A%09%09if%20%28taskNote%20%21%3D%20%27%27%29%7B%0A%09%09%09taskNote%20%3D%20encodeURIComponent%28taskNote%29%0A%09%09%09urlStr%20%3D%20urlStr%20%2B%20%22%26%22%20%2B%20%22note%3D%22%20%2B%20taskNote%0A%09%09%7D%0A%09%09URL%2EfromString%28urlStr%29%2Eopen%28%29%0A%09%7D%0A%7D%7Dcatch%28err%29%7Bconsole%2Elog%28err%29%7D
			
				New Task from Selected Item Copy Script  Run Script     01 items  = document .editors [0].selection .items 02 if  (items .length  === 1){03   try {taskName  = items [0].topic } catch (err ){taskName  = '' }04   try {taskNote  = items [0].note } catch (err ){taskNote  = '' }05   if (taskName  != '' ){06   taskName  = encodeURIComponent (taskName )07   urlStr  = "omnifocus://localhost/add?name="  + taskName 08   if  (taskNote  != '' ){09   taskNote  = encodeURIComponent (taskNote )10   urlStr  = urlStr  + "&"  + "note="  + taskNote 11   }12   URL .fromString (urlStr ).open ()13   }14 } 
			
			
			
			And a version that includes a link-back to the source OmniOutliner item in the note of the created task:
			
			items = document.editors[0].selection.items
if (items.length === 1){
	try{taskName = items[0].topic} catch(err){taskName = ''}
	try{taskNote = items[0].note} catch(err){taskNote = ''}
	itemLink = 'omnioutliner:///open?row=' + items[0].identifier
	itemLink = encodeURIComponent(itemLink)
	if(taskName != ''){
		taskName = encodeURIComponent(taskName)
		urlStr = "omnifocus://localhost/add?name=" + taskName
		if (taskNote != ''){
			taskNote = encodeURIComponent(taskNote)
			urlStr = urlStr + "&" + "note=" + taskNote + "%0A%0A" + itemLink
		} else {
			urlStr = urlStr + "&" + "note=" + itemLink
		}
		URL.fromString(urlStr).open()
	}
}
			omnioutliner://localhost/omnijs-run?script=try%7Bitems%20%3D%20document%2Eeditors%5B0%5D%2Eselection%2Eitems%0Aif%20%28items%2Elength%20%3D%3D%3D%201%29%7B%0A%09try%7BtaskName%20%3D%20items%5B0%5D%2Etopic%7D%20catch%28err%29%7BtaskName%20%3D%20%27%27%7D%0A%09try%7BtaskNote%20%3D%20items%5B0%5D%2Enote%7D%20catch%28err%29%7BtaskNote%20%3D%20%27%27%7D%0A%09itemLink%20%3D%20%27omnioutliner%3A%2F%2F%2Fopen%3Frow%3D%27%20%2B%20items%5B0%5D%2Eidentifier%0A%09itemLink%20%3D%20encodeURIComponent%28itemLink%29%0A%09if%28taskName%20%21%3D%20%27%27%29%7B%0A%09%09taskName%20%3D%20encodeURIComponent%28taskName%29%0A%09%09urlStr%20%3D%20%22omnifocus%3A%2F%2Flocalhost%2Fadd%3Fname%3D%22%20%2B%20taskName%0A%09%09if%20%28taskNote%20%21%3D%20%27%27%29%7B%0A%09%09%09taskNote%20%3D%20encodeURIComponent%28taskNote%29%0A%09%09%09urlStr%20%3D%20urlStr%20%2B%20%22%26%22%20%2B%20%22note%3D%22%20%2B%20taskNote%20%2B%20%22%250A%250A%22%20%2B%20itemLink%0A%09%09%7D%20else%20%7B%0A%09%09%09urlStr%20%3D%20urlStr%20%2B%20%22%26%22%20%2B%20%22note%3D%22%20%2B%20itemLink%0A%09%09%7D%0A%09%09URL%2EfromString%28urlStr%29%2Eopen%28%29%0A%09%7D%0A%7D%7Dcatch%28err%29%7Bconsole%2Elog%28err%29%7D
			
			
				New Task from Selected Item with Link-Back Copy Script  Run Script     01 items  = document .editors [0].selection .items 02 if  (items .length  === 1){03   try {taskName  = items [0].topic } catch (err ){taskName  = '' }04   try {taskNote  = items [0].note } catch (err ){taskNote  = '' }05   itemLink  = 'omnioutliner:///open?row='  + items [0].identifier 06   itemLink  = encodeURIComponent (itemLink )07   if (taskName  != '' ){08   taskName  = encodeURIComponent (taskName )09   urlStr  = "omnifocus://localhost/add?name="  + taskName 10   if  (taskNote  != '' ){11   taskNote  = encodeURIComponent (taskNote )12   urlStr  = urlStr  + "&"  + "note="  + taskNote  + "%0A%0A"  + itemLink 13   } else  {14   urlStr  = urlStr  + "&"  + "note="  + itemLink 15   }16   URL .fromString (urlStr ).open ()17   }18 } 
		
			
			
			Solitary Action PlugIn
			
			And with a slight modification, the previous script can be turned into an Omni Automation action that you can install on your macOS and iOS devices:
			
			/*{
	"type": "action",
	"targets": ["omnioutliner"],
	"author": "Otto Automator",
	"version": "1.0",
	"identifier": "com.omni-automation.oo-of.item-to-task"
	"description": "Script creates a new OmniFocus task from the selected outline item.",
	"label": "Task from Selected Item",
	"shortLabel": "Task from Selected Item"
}*/
(() => {
	
	var action = new PlugIn.Action(function(selection, sender) {
		// action code
		// selection options: columns, document, editor, items, nodes, styles
		selection.items.forEach(function(item){
			try{taskName = item.topic} catch(err){taskName = ''}
			try{taskNote = item.note} catch(err){taskNote = ''}
			if(taskName != ''){
				taskName = encodeURIComponent(taskName)
				urlStr = "omnifocus://localhost/add?name=" + taskName
				if (taskNote != ''){
					taskNote = encodeURIComponent(taskNote)
					urlStr = urlStr + "&" + "note=" + taskNote
				}
				URL.fromString(urlStr).open()
			}
		})
	});
	action.validate = function(selection, sender) {
		// validation code
		// selection options: columns, document, editor, items, nodes, styles
		return (selection.items.length === 1)
	};
	
	return action;
})();
			
				Selected Item to New Task Web Console  Install Plug-In     01 /*{ 02   "type" : "action",03   "targets" : ["omnioutliner"],04   "author" : "Otto Automator",05   "version" : "1.0",06   "identifier" : "com.omni-automation.oo-of.item-to-task"07   "description" : "Script creates a new OmniFocus task from the selected outline item.",08   "label" : "Task from Selected Item",09   "shortLabel" : "Task from Selected Item"10 }*/ 11   12 (() => { 13   14   var  action = new   PlugIn .Action (function (selection, sender) {15   16   17   selection.items.forEach (function (item){18   try {taskName = item.topic} catch (err){taskName = '' }19   try {taskNote = item.note} catch (err){taskNote = '' }20   if (taskName != '' ){21   taskName = encodeURIComponent(taskName)22   urlStr = "omnifocus: + taskName 23   if  (taskNote != '' ){24   taskNote = encodeURIComponent(taskNote)25   urlStr = urlStr + "&"  + "note=" + taskNote26   }27   URL.fromString (urlStr).open()28   }29   })30   });31   32   action.validate = function (selection, sender) {33   34   35   return  (selection.items.length  === 1)36   };37   38   return  action;39 })(); 
			
				
				  
				  Your browser does not support the video tag.
				  
			
			
				PLAY 
				PAUSE 
				BACK 
				REWIND 
			
			
		 
				
		
		
			
				TOPICS
				Home 
				
				Document 
				Outline 
				Item 
				Editor 
				Style 
				Text 
				App-to-App 
				Item to Task
				Item to Project 
				Document to Task 
				Slides from Outline 
				Scripting Dictionary 
				Action Template 
				
				
				
			 
			
			
				UNDER CONSTRUCTION
				This webpage is in the process of being developed. Any content may change and may not be accurate or complete at this time.
			 
			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.