Send link to OmniFocus using a tag and smart rule

I’m aware that DT comes with pre-installed scripts to use with OmniFocus (OF), but this feature is not what I am looking for.

What I would like to do is to have a smart rule search for notes tagged ‘review’ and then for that file’s name and URL to be passed to OF so I can review that file later. It’s basically a version of the Evernote2Omnifocus script, but obviously with DT instead of Evernote.

I’ve tried my own scripting, based on the scripts mentioned at the top, and searching for something like this on the forums, but can’t find anything. The error I’m currently getting using my script is “Error1708”. Can anyone help?

Cheers

Not without your script.

Please post the script wrapped in three backticks and a new line, like this

```
script

```

Hello,

Thanks for getting back to me Pete31, my apologies for not responding sooner. I’ve managed to work out how to do this through a bit of trial and error, and I thought for completeness I would post the script below. I’m sure it’s not well written (I am far from a coder; this is the first AppleScript I’ve pulled together) so any feedback is more than welcome.

-- Script to add a group of items to OmniFocus as a to-do
-- Written by Ed Moloney on 26/04/2021 at 17:00, with lots of help from the community/ other people's scripts including the one written by Eric Böhnisch-Volkmann and Jim Neumann. 
on performsmartrule(theRecords)
	
	try
		-- Get the selection
		tell application id "DNtp" to repeat with theRecord in theRecords
			
			-- Get and format the data we need
			tell application id "DNtp"
				set theSummary to (name of theRecord) as string
				set theURL to (reference URL of theRecord) as string
			end tell
			
			-- Add new to do to OmniFocus
			try
				tell application "OmniFocus"
					tell default document to set newTask to make new inbox task with properties {name:theSummary, note:theURL}
				end tell
			on error errmsg
				display alert (localized string "OmniFocus is not available. You may need to update to OmniFocus Pro to use this script.")
			end try
			
		end repeat
		
	on error errmsg
		
		display alert (localized string "Error when adding item to OmniFocus") message errmsg
		
	end try
	
	
end performsmartrule

Cheers,

Ed

1 Like

Thanks for sharing, this is useful.

Oh, … I had been trying to get something like this work for sometime - works right out the box - marvellous - thanks for sharing!!!

You’re welcome, glad it was useful :grinning: