Feature Request: Add Notes to Tags

Please do so and post a reference so others can join your request via mail.

It’s quite funny I forgot to mention that I’d like to see this feature too - and now reading this thread again with Script Debugger open I simply tried something … While it’s not possible to access a tag’s note via UI it is possible to set and get it via AppleScript.

So we could use one script to set a note to e.g. a DEVONthink link and another one that tries to open the note’s content.

(I recently started to use OmniFocus again after some years and don’t know the dictionary yet so these scripts might not be the right way to do it)

-- Set tag's note to URL

tell application "OmniFocus"
	try
		set theSelection to selected trees of content of item 1 of document windows of default document
		if theSelection ≠ {} then
			set thisTag to value of item 1 of theSelection
		else
			set theSelection to selected trees of sidebar of item 1 of document windows of default document
			if theSelection ≠ {} then
				set thisTag to value of item 1 of theSelection
			else
				error "No selection"
			end if
		end if
		
		set theNote to note of thisTag
		set note of thisTag to (text returned of (display dialog "Insert URL:" default answer theNote))
		-- or 
		#set note of thisItem to (the clipboard) as string
		
	on error error_message number error_number
		if the error_number is not -128 then display alert "OmniFocus" message error_message as warning
		return
	end try
end tell

-- Open URL from tag's note

tell application "OmniFocus"
	try
		set theSelection to selected trees of content of item 1 of document windows of default document
		if theSelection ≠ {} then
			set thisTag to value of item 1 of theSelection
		else
			set theSelection to selected trees of sidebar of item 1 of document windows of default document
			if theSelection ≠ {} then
				set thisTag to value of item 1 of theSelection
			else
				error "No selection"
			end if
		end if
		
		set theNote to note of thisTag
		if theNote ≠ "" then
			try
				do shell script "open " & quoted form of theNote
			end try
		else
			error "Empty note"
		end if
		
	on error error_message number error_number
		if the error_number is not -128 then display alert "OmniFocus" message error_message as warning
		return
	end try
end tell

1 Like