View Single Post
Not sure if this is a bug or just an inconsistency. Here's a script that demonstrates the issues (which I'll also send to the ninjas):

Code:
(* 
	Run this script with one of the built-in sidebar items selected (e.g. No Context 
	or Context in context mode, or Inbox or Library in planning mode).  The fourth
	set will yield an error.  Run it again with a project, context, or folder selected
	and everything is fine.  
	
	In the first case, bar is set to something like:
		value of tree 2 of sidebar of document window id 60308 of document id "jwv2Yzh3ZwG"
	
	In the second case, bar is set to something like: 
		project id "o-8rLx0w-T7" of document id "jwv2Yzh3ZwG"
	
	(To see this, run the script from Script Editor with the Event Log showing.)
*)
tell application "OmniFocus"
	tell document 1
		tell document window 1
			set foo to item 1 of selected trees of sidebar
			set bar to value of foo
			set blah to name of foo
			set baz to name of bar -- unexpected error
		end tell
	end tell
end tell
There seem to be a couple of issues. The sidebar in planning mode has properties "library" and "inbox", which return objects of class "library tree" and "inbox tree" respectively. These classes are subclasses of "tree", which has a "value" property. But it's unclear what "value" should return for these. Perhaps just the tree itself again?

Another inconsistency is that the sidebar in context mode doesn't have properties for No Context and Contexts, which it seems like it might in analogy with planning mode.
__________________
Cheers,

Curt