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

 
Applescript request - Jump to Project Thread Tools Search this Thread Display Modes
For reference, here is the LaunchBar script which I use for focusing on Projects whose names contain a string entered at the Launchbar prompt.

Its a quick and simple approach, which just refocuses the current window on any projects (up to a maximum number) whose names contain the entered string.

Useful to me as I often have a small group of projects with related names.

Code:
(* 
	Run from Launchbar to refocus current window on any projects
	whose names match a sub-string entered  in Launchbar.
	
	If the script is indexed in and summoned from Launchbar,
	tapping spacebar will allow you enter enough of any substring 
	of a project name to uniquely identify it. 
	
	If the string entered turns out not to be unique, 
	then a list of candidate projects will get the focus in the current window.
	
	(Useful to me as I often have a small set of projects with related names)
*)

property pstrTitle : "Focus on project"
property pmaxProjCount : 10

on handle_string(strprojectName)
	if length of strprojectName > 0 then
		tell application id "com.omnigroup.OmniFocus"
			set oDoc to default document
			
			set lstprojects to my ProjectsByName(oDoc, strprojectName)
			if lstprojects is not missing value then
				set focus of front document window of oDoc to lstprojects
			else
				display dialog "No projects with name containing " & return & return & 
					tab & quote & strprojectName & quote & return & return & 
					"found in the OF database" with title pstrTitle
			end if
			activate oDoc
		end tell
	end if
end handle_string

on ProjectsByName(oDoc, strName)
	using terms from application "OmniFocus"
		tell oDoc
			set lstMatches to (complete strName as project 
				maximum matches pmaxProjCount)
			if length of lstMatches > 0 then
				set lstprojects to {}
				repeat with recMatch in lstMatches
					set end of lstprojects to project id (id of recMatch)
				end repeat
				return lstprojects
			else
				return missing value
			end if
		end tell
	end using terms from
end ProjectsByName
 
 


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
Feature Request : Jump quickly from action to project alexjrice OmniFocus for iPhone 12 2011-01-02 02:11 AM
A way to jump from a task to its home project? jkorentayer OmniFocus 1 for Mac 4 2009-10-19 01:09 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 04:35 AM.


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