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 to jump from inbox to project Thread Tools Search this Thread Display Modes
In response to a post on the Omnifocus general forum, here is a draft script which works when an inbox item (which already has an assigned project) is selected.

It opens up a new window, which focuses on the Inbox and the assigned project. One can then drag and drop inbox tasks to the appropriate points in the project list.

[If the selected task is not in the inbox, the script creates a window which focuses on the parent project]

To install, you could save the script from the Script Editor to ~/Library/Scripts/Applications/Omnifocus under your user folder,
and then choose View/Customize_Toolbar from the Omnifocus menu. This will enable you to drag the script onto the toolbar.

Code:
tell application "OmniFocus"
	tell window 1
		try
			set lstTrees to selected trees of content
		on error
			return
		end try
		if (count of lstTrees) > 0 then
			set oValue to value of item 1 of lstTrees
			if class of oValue = task then
				set idTask to id of oValue
				set oProj to containing project of oValue
				tell front document of application "OmniFocus"
					set winFocus to make new document window with properties 
						{selected view mode identifier:"project", search term:""}
				end tell
				tell winFocus
					set focus to {oProj}
					tell sidebar to select library
					repeat with oItem in trees of content
						my Expand(oItem)
					end repeat
					tell content
						select leaf id idTask
					end tell
				end tell
			else if class of oValue = inbox task then
				set idTask to id of oValue
				set oProj to assigned container of oValue
				if class of oProj = project then
					tell front document of application "OmniFocus"
						set winFocus to make new document window with properties 
							{selected view mode identifier:"project", search term:"", focus:{oProj}}
					end tell
					tell winFocus
						tell sidebar
							select every leaf
						end tell
						tell content
							select leaf id idTask
						end tell
						my Expand(last item of trees of content)
					end tell
				end if
			end if
		end if
	end tell
end tell


on Expand(oTree)
	using terms from application "OmniFocus"
		set oSubTrees to trees of oTree
		
		if (count of oSubTrees) > 0 then
			set expanded of oTree to true
			repeat with oSubTree in oSubTrees
				Expand(oSubTree, true)
			end repeat
		end if
	end using terms from
end Expand

Last edited by RobTrew; 2008-03-12 at 12:19 PM.. Reason: Update code
 
Cool script, Rob - works for me.

If you or anyone is thinking of developing this any further, some kind of beep or feedback when no project has been assigned would be an improvement -- or even better, how about it beeps and places the cursor in the project column?

Also, is there a way to further alter the appearance of the new window? A smaller window with no toolbar and no tree pane would be still handier in my opinion.

Last edited by Craig; 2008-03-08 at 10:16 AM..
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Keyboard shortcut to jump to a particular project? ecf OmniFocus 1 for Mac 6 2011-07-06 03:09 PM
Jump to Project sprocketjockey OmniFocus 1 for Mac 5 2011-05-10 07:55 AM
Applescript request - Jump to Project gcrump OmniFocus Extras 30 2010-06-07 10:48 PM
Mark as Reviewed does not jump to next available project joshfree OmniFocus 1 for Mac 1 2009-03-13 04:23 PM
jump to project from action? hexsprite OmniFocus for iPhone 4 2008-08-15 05:54 PM


All times are GMT -8. The time now is 09:04 AM.


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