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

 
Script: Focus on Current Selection Thread Tools Search this Thread Display Modes
Some of this was cribbed from Curt Clifton's Populate Template Placeholders scripts. The basic idea is: let's say that you have a task selected in a 'Next Actions' list, or in Context mode, or whatever -- you can't see the entire project, and you would like to. This script will open a new window with focus set to the projects of whichever tasks (or projects) you currently have selected. Nothing more, but nothing less.

Hope it's useful
Jeremy

Code:
tell application "OmniFocus"
	tell front document
		tell document window 1 -- (first document window whose index is 1)
			set theSelectedItems to selected trees of content
			if ((count of theSelectedItems) < 1) then
				-- try sidebar selection
				set theSelectedItems to selected trees of sidebar
			end if
		end tell
		if ((count of theSelectedItems) < 1) then
			display alert "You must first select a project or a task." message "Select a project or task to focus on." as warning
			return
		end if
		set theSelection to {}
		repeat with i from 1 to count of theSelectedItems
			set selectedItem to the value of item i of theSelectedItems
			if class of selectedItem is task then
				set selectedItem to containing project of selectedItem
			end if
			copy selectedItem to end of theSelection
		end repeat
		
		set newWin to make new document window with properties {selected view mode identifier:"project", focus:theSelection}
	end tell
end tell
 
Nice script, Jeremy. I'm glad you were able to use some of my code.

In OF you can double click the handle of an item in Context mode to focus on the item's project in a new window. Your script supports multiple items, which is a nice refinement.
__________________
Cheers,

Curt
 
Ah, I didn't know about the handle click. Thanks for that! In any case, this works in Proejct mode, as well and supports multiple items. Thanks for checking it out!
 
The double-click on a handle works in project mode as well, but it won't do multiple projects, so your script is a useful tool. It's also faster than creating a new window and then focusing on a select group of projects -- something I try to avoid due to the inevitable pause.
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Project view sidebar bug: Selection/Focus/Filter RobTrew OmniFocus 1 for Mac 2 2010-08-17 11:19 AM
Apple-Script triggered exports of selection into separate images in OmniGraffle 5 Pro Scifer_2008 OmniGraffle General 0 2008-09-03 06:01 AM
Be cautious with Script Debugger & current SneakyPeek builds RobTrew OmniFocus Extras 1 2008-02-16 09:55 AM
The pointless "focus" functionality with current implementation of single tasks ksenia OmniFocus 1 for Mac 6 2007-08-13 08:32 AM
Current Selection in Quicksilver snozle OmniWeb Bug Reports 0 2007-01-19 12:40 PM


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


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