View Single Post
Originally Posted by whpalmer4 View Post
If you've closed all of the windows, there isn't a selected action.
Well, that is certainly what theory might predict, but OF has a surprise in store for us ...

It turns out that if you close the last document window through the GUI, (clicking on the close button at top left) there is still one invisible document window, which does in fact have a selection, and will return a value to code like:

tell application id "com.omnigroup.OmniFocus"
	tell default document
		tell content of front document window
			id of (selected trees)
		end tell
	end tell
end tell
(The invisible document window is, it seems, pre-baked in readiness to become, at the flick of the visibility switch, the New Window specified by the settings under Preferences > General > Open New Window)

I have now amended the script (to ver .7) to look only for selections in visible windows ...


Last edited by RobTrew; 2010-12-23 at 11:04 AM.. Reason: Added link to script