OmniFocus Quick Entry Task with Link to Record

This is a really simple script; I was surprised I couldn’t find it posted anywhere. I copy this into an automator service and bind it to a hotkey. I funnel all my email, documents, voicemails, faxes, etc into my DT inbox, then I create tasks as I walk through the inbox with a link back to the record for quick reference. Feedback or improvements welcome and appreciated. :slight_smile:


(* 
Opens the OmniFocus Quick Entry tray with a link to the currently selected DevonThink record in the notes. 

Use in Automater as a service and bind to a hotkey.

-WPS 02.12.2014
*)

try
	tell application id "DNtp"
		
		set theDatabase to current database
		set theSelection to selection
		if theSelection is {} then error "Please select something"
		
		set theURL to the reference URL of item 1 of theSelection
		
	end tell
	tell application "OmniFocus"
		tell quick entry
			open
			
			set NewTask to make new inbox task
			set the note of NewTask to theURL
			
			activate
		end tell
	end tell
end try


You probably didn’t find anything similar posted as DEVONthink Pro and Pro Office ships with reminders scripts for several applications, including OmniFocus. Look in DEVONthink’s scripts menu, under Reminders.

Correct but this works a bit different. The packaged script sends the DT item into the OmniFocus inbox and prompts for a reminder only. That is fine for many workflows that utilize the OF inbox. The user has to organize the entry later when reviewing the OF inbox.

Personally, I try to minimize my inboxes, and have been trying to use just DT for collection. I use OF as my action list only. So I send the action straight to a project/context/due date right from the OF quick entry prompt as a review my DT inbox.

Anyway, it is a simple script but maybe it will save someone a few extra minutes :smiley:

Has the DTP script been updated to work with OmniFocus 2.0.2? When I try to run it I get the error message “OmniFocus is not available.” All other Reminder scripts seems to work fine.

I find with OF2 that this script, the one that DEVONthink ships with, and others such as the PopClip extension all require OF2 to be running before they work correctly. Once OF2 is running, all of these scripts work without error. For me.

OF2 is running, and same message appears. Would appreciate any suggestions. (Thanks, korm!)

Perhaps your instance of OmniFocus has a different name, such as “OmniFocus 2.app” (in your Applications folder)?

I haven’t been successful making the script fail, and I don’t see anything wrong going on when I run the script step-wise in debug mode, so I’m pretty sure that there’s nothing wrong with the code itself.

It also could depend on which version of OmniFocus you are using (Pro or regular) and where you bought it (direct from Omni or from the MAS). I believe each version uses a unique app id. If you are using the non-pro version, I suspect that the script might fail as (IIRC), only the Pro version has Applescript support.

I am using the ‘regular’ version of OF, so that must be the problem, unfortunately. And it is named correctly (OmniFocus.app). Thank you both!