OmniFocus hook to tag

omnifocus hook Get Address scripts can add tag link support

tell front window of application "OmniFocus"
    try
        set theTrees to selected trees of content
        if (count of theTrees) < 1 then
            set theTrees to selected trees of sidebar
        end if
        if (count of theTrees) < 1 then
            return
        end if
        set theSelection to value of item 1 of theTrees
        
        if class of theSelection is folder then
            set theURI to "omnifocus:///folder/" & id of theSelection
	else if class of theSelection is tag then
	    set theURI to "omnifocus:///tag/" & id of theSelection
        else
            set theURI to "omnifocus:///task/" & id of theSelection
        end if
    end try
end tell
3 Likes

Just what I was looking for - works great thanks :slight_smile:

1 Like