Getting the path of a project
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[/CODE] |
Thanks, Rob! Very useful to open support material folders from a mirrored hierarchy in Finder.
|
Hierarchy mirroring is, of course, a bit fragile. If we reorganise the folder hierarchy on either side (OF or file system) the link to the mirrored support folders is broken.
This is one of the reasons for which I now keep my support material for OmniFocus projects in corresponding DEVONthink folders, rather than in file system folders. Current versions of [URL="http://bit.ly/OF-DT"]these scripts[/URL] do still initially create parallel folder hierarchies within DEVONthink, but the links between the folders and the OF projects are maintained by DT and OF hyperlinks, which are position-independent. (DT urls are placed in the note field of the OF project, and the URL fields of DT records (folders/files) contain links back to the OF project). This means that I can reorganize the nesting of my OF or DT folders without breaking the OF <--> DT links. [COLOR="White"]--[/COLOR] |
All times are GMT -8. The time now is 11:58 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.