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 Today's Posts

 
Getting the path of a project Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
I have been asked how one can get the full path of a project that may be nested within one or more folders.

The following snippet includes some elements that could be reused:
Code:
on run
	tell application id "OFOC"
		
		tell front document window of front document
			repeat with oPanel in {sidebar, content}
				set lstValue to value of (selected trees of oPanel where class of its value is project)
				set lngProj to count of lstValue
				if lngProj > 0 then exit repeat
			end repeat
			if lngProj < 1 then return
		end tell
	end tell
	set oProject to first item of lstValue
	
	set lstPath to ProjectPath(oProject)
	
	set {dlm, my text item delimiters} to {my text item delimiters, "/"}
	set strPath to lstPath as Unicode text
	set my text item delimiters to dlm
	
	set strPath to do shell script ("printf '%q' " & quoted form of strPath)
end run

on ProjectPath(oProject)
	tell application id "OFOC"
		tell oProject
			set lstPath to {name}
			set oContainer to container
		end tell
		
		repeat while class of oContainer is not document
			set beginning of lstPath to name of oContainer
			set oContainer to container of oContainer
		end repeat
	end tell
	lstPath
end ProjectPath
 
 




Similar Threads
Thread Thread Starter Forum Replies Last Post
Critical Path - won't highlight path aboeing OmniPlan General 4 2014-04-09 12:49 PM
Sub-project critical path mfarmer OmniPlan General 1 2011-02-14 10:02 AM
Missing the whole project path HuConn OmniFocus for iPhone 2 2010-09-09 03:57 PM
The Path to being an OG Ninja bump OmniGraffle General 1 2010-07-14 09:45 AM
Critical Path MacBerry OmniPlan General 11 2009-03-15 07:36 AM


All times are GMT -8. The time now is 03:42 AM.


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