View Single Post
Craig,

I get it now. That's a cool idea. Here's a script that will attempt to activate a named perspective, make sure project mode is selected, then select all projects excluding SALs in the sidebar. Activating the perspective seems a bit wonky, but the rest of it works fine. I don't plan to support this script, but hope you and others find it useful. Feel free to modify per the open license terms.

Cheers,

Curt

Code:
(* 
	This script selects all projects in the sidebar, but no single-action lists.

	version 0.1, by Curt Clifton
	
	Copyright © 2009, Curtis Clifton
	
	All rights reserved.
	
	Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
	
		• Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
		
		• Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
		
	THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
	
	version 0.1: Original release

*)

property projectModePerspective : "Projects"

tell application "OmniFocus"
	tell document window 1 of default document
		set perspective name to projectModePerspective
		set selected view mode identifier to "project"
		if perspective name is missing value then
			(* display alert "Unable to open a perspective named '" & projectModePerspective & ".  Just switching to project mode with current settings." *)
		end if
		tell library of sidebar
			set allTrees to every tree
			my selectProjects(allTrees)
		end tell
	end tell
end tell

on selectProjects(theTrees)
	using terms from application "OmniFocus"
		repeat with aTree in theTrees
			set treeValue to value of aTree
			if (class of treeValue is project) then
				set selected of aTree to not (singleton action holder of treeValue)
			else if (class of treeValue is folder) then
				set selected of aTree to false
				set childTrees to every tree of aTree
				my selectProjects(childTrees)
			else
				set selected of aTree to false
			end if
		end repeat
	end using terms from
end selectProjects
__________________
Cheers,

Curt