The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniFocus > OmniFocus Extras
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
select all in sidebar etc. Thread Tools Search this Thread Display Modes
I'm trying to turn the "Exclude SALs from selection" script from this forum into something more automated to go into an Automator workflow, but I'm no scripting expert. Here's where I'm stuck:

(1) I cannot figure out how to applescript the selection of all items in the Omnifocus sidebar.

(2) What's the syntax for focusing on selected items?

(3) Also, is there a way to update ("take a snapshot of") existing perspectives via applescript?

Any help is appreciated!
 
bump.
 
How about providing a link to the script in question? Some sample code or an indication of what you've tried or how you're approaching the problem would also be helpful.

The 'select' command should handle selecting the items, so that reduces the problem to generating a list of items to be selected. But it's unclear to me how selecting items is a useful thing in an Automator workflow. Can you describe the overall problem you're trying to solve? In general, people are more likely to offer scripting help if either the question is narrowly framed or they see how the overall solution might be beneficial.

Cheers,

Curt
__________________
Cheers,

Curt
 
I believe I'm the author of the script he's attempting to modify. It is posted in this thread: http://forums.omnigroup.com/showthread.php?t=12955 and the code for grabbing the list of stuff to process is essentially identical to the usual construction of your scripts, I think. It relies on the user having already selected something in the sidebar, and that's the part that the OP wants to script.

I don't think there's any Applescript support in OmniFocus for taking a snapshot of a perspective, though you could probably do it with UI scripting.
 
Quote:
Originally Posted by whpalmer4 View Post
I believe I'm the author of the script he's attempting to modify. It is posted in this thread: http://forums.omnigroup.com/showthread.php?t=12955 and the code for grabbing the list of stuff to process is essentially identical to the usual construction of your scripts, I think. It relies on the user having already selected something in the sidebar, and that's the part that the OP wants to script.
That's exactly right. My apologies for insufficient explicitness.

The problem I'm trying to solve is this. (Re-reading whpalmer's link, I realize it's similar or identical to the situation user AmberV describes in the post immediately following the script in that thread.) I have my planning set up as areas-of-responsibility folders, each of which has projects and a "singletons" SAL. I also have an automator workflow that takes me step-by-step through my weekly review. It is mostly just confirmation boxes instructing me on each step, and simple applescripts that open iCal, appropriate OF perspectives, and so on.

One of the main steps in my weekly review is to review all my projects of course. To do that by hand I've found I can select all in the sidebar and run whpalmer's script (actually a modified one which also deselects folders), then hit Focus. If I want I could save this as a perspective, but it's not that useful because by the next weekly review I may have added a project which will then fall through the cracks if I don't go through the script filtering again.

So all of that is not terribly inconvenient to do, but I would like to be able to have my automator workflow do it for me. Thus my questions in the original post of this thread.
 
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
 
Awesome, thanks a bunch, Curt.
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Select behind artdog OmniGraffle General 3 2010-09-09 02:50 AM
How to select? davidamis OmniFocus Extras 2 2009-04-08 09:09 AM
How to select all level n vanity OmniOutliner 3 for Mac 6 2008-01-25 12:31 PM
How to *just* select a Project? santra OmniFocus 1 for Mac 12 2007-10-05 04:26 AM
non-linear select bjordan OmniOutliner 3 for Mac 1 2007-08-09 11:23 AM


All times are GMT -8. The time now is 08:30 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.