I can’t manage to figure out how to check if currently a focus in OmniFocus is set. I can access the focus property but it always seems to have elements, even if no focus.
tell application "OmniFocus"
tell the default document
tell the front document window
log (count of focus)
end tell
end tell
end tell
This seems to grab the folder / project in focus if present
tell application "OmniFocus"
tell the default document
tell the front document window
try
set myFocus to item 1 of focus
--log (count of focus)
return name of myFocus
end try
end tell
end tell
end tell
Thanks guys, I was able to put together what I wanted (a script to toggle focus on specific folders) like this:
tell application "OmniFocus"
tell the default document
set folderList to folders whose name is "Office"
tell the front document window
try
set myFocus to item 1 of focus
set focus to {}
return
end try
set focus to folderList
end tell
end tell
end tell