Check if Focus is set in applescript

Hi,

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

No one an idea?

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

Perhaps checking on:

length of items of focus of front document window of front document of Application "OmniFocus".

A value greater than 0, means at least one item is focused.

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