Description
Originally posted on CAPH Tech (Note: Website is Japanese / 日本語), this script will copy a link to the currently selected task/project/folder in OmniFocus to your clipboard.The Code
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 the clipboard to "omnifocus:///folder/" & id of theSelection
else if class of theSelection is project then
set the clipboard to "omnifocus:///project/" & id of theSelection
else
set the clipboard to "omnifocus:///task/" & id of theSelection
end if
end try
end tell
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 the clipboard to "omnifocus:///folder/" & id of theSelection
else if class of theSelection is project then
set the clipboard to "omnifocus:///project/" & id of theSelection
else
set the clipboard to "omnifocus:///task/" & id of theSelection
end if
end try
end tell