Old script to manage project folders in Finder stopped working

Resurrecting this old thread. I think you’re referring to the script in this thread. I paste my slightly adapted version “as is” with no guarantees. It works for me in OF3. Open Script Editor, paste the script below and save it as a script (.scpt) file (a script bundle would also work). You may optionally customize the script icon in the Finder (Finder > File > Get Info, then drag an .icns file to the icon next to the file name).

In OmniFocus, go to Help > Open Scripts Folder, and drag the script file there. Then you may right-click on the toolbar and choose Customize Toolbar…, and put the script in OF toolbar.

The script requires a Finder folder called Reference to exist inside your Documents folder (otherwise update the projectsDir property in the script).

To use the script, simply select a project and click on the script icon in OF toolbar. This will open the folder in the Finder, creating it if it does not exist.

The script can be easily adapted to pre-populate the folder’s structure. Currently, it creates a file linking back to the project in OF. It also supports creating an OmniOutliner document in the project’s folder, but that is turned off by default (I have never used that feature, not sure if it works).

I see that there’s some dead code, but that doesn’t break the script.

Finally, I recommend that you set the Finder’s window size to your liking (see set bounds of the front window …).

Hope this helps!

--Adapted from a script written by Jim Harrison, Dec 2008 (jhh.med.virginia.edu).
--May be used, edited and redistributed without restriction.
--Opens a folder at a specified location that has the same name as an OmniFocus project that contains the selection
--Edit the name and path below to correspond to the location of the main Projects folder that will contain the individual project folders
property projectsFolderName : "Projects" -- name for projects folder (change this as you like)
set projectsDir to (path to documents folder as text) & "Reference" & ":" -- Path to projects folder (change this as you like)
set askForConfirmation to false -- Set to true if you want the script to ask for confirmation before creating new folders
set linkPrefix to "¥ [OF] " -- change this as you like
set ooPrefix to "¥ " -- change this as you like
set ooSuffix to " notes" -- change this as you like
--Edit the name and file extension below if you wish to use another application to create and edit the project notes files
set ooExtension to ".oo3"
set linksInAllFolders to false -- Set to true if you want an OF link in every folder (not only for projects)
set createOODocument to false -- Set to true if you do want an OO document to be created for each project
-- Assign labels to projects and folders according to their status 
-- 0=none, 2=red, 1=orange, 3=yellow, 6=green, 4=blue, 5=purple, 7=grey.
property activeColor : 6
property onholdColor : 3
property droppedColor : 7
property doneColor : 7
property dueSoon : 1
property flagged : 4
property hiddenFolder : 5
property activeFolder : 1
------ To resize and arrange Finder windows
property topoff : 45 -- offset from screen top
property bottomoff : 60 -- offset from screen bottom
--------------------------------------------------------------------------------------------------------------------------

tell front window of application "OmniFocus" -- get the name of the project containing the current selection
	try
		set theTrees to the selected trees of content
		if the (count of theTrees) is less than 1 then
			set theTrees to the selected trees of sidebar
		end if
		if the (count of theTrees) is less than 1 then
			display dialog "To open a project folder, click on or in a project, task or note before running this script" buttons {"Ok"} default button 1
			return
		end if
		set theSelection to value of item 1 of theTrees
		if the class of theSelection is folder then
			set thisProjList to {the name of theSelection}
			log theSelection
			set theGroup to the container of theSelection
			set theLinkList to {"omnifocus:///folder/" & the id of theSelection}
			set isProjectFolder to false
			if hidden of theSelection then
				set theStatus to "inactive folder"
			else
				set theStatus to "active folder"
			end if
		else
			set thisProjList to {the name of the containing project of theSelection}
			set theGroup to the container of the containing project of theSelection
			set theLinkList to {"omnifocus:///task/" & the id of the containing project of theSelection}
			set isProjectFolder to true
			set theStatus to ((the status of the containing project of theSelection) as string) & " project"
		end if
		repeat while the class of theGroup is not document
			set thisProjList to {the name of theGroup} & thisProjList
			set theLinkList to {"omnifocus:///folder/" & the id of theGroup} & theLinkList
			set theGroup to the container of theGroup
		end repeat
	on error
		display dialog "Click on or in a project, task or note before running this script." buttons {"OK"} default button 1
		return
	end try
end tell

set oldDelimiter to AppleScript's text item delimiters
set AppleScript's text item delimiters to ":"
set thisProjPath to thisProjList as text
set AppleScript's text item delimiters to oldDelimiter

tell application "Finder"
	activate
	try
		open folder (projectsDir & projectsFolderName & ":" & thisProjPath & ":")
		set comment of folder (projectsDir & projectsFolderName & ":" & thisProjPath & ":") to theStatus
	on error
		try
			if not (folder (projectsDir) exists) then
				display dialog "Please create the folder " & projectsDir & " and try again."
				return
			end if
			if askForConfirmation then
				set answer to display dialog "Some folders do not exist yet. Should I create them?" buttons {"Cancel", "OK"} default button 1
				if the button returned of answer is "Cancel" then return
			end if
			
			set theCurrentPath to projectsDir & projectsFolderName & ":"
			if not (folder (theCurrentPath) exists) then
				make new folder at projectsDir with properties {name:projectsFolderName}
			end if
			
			set theParentPath to theCurrentPath
			repeat with i from 1 to (count thisProjList) - 1
				set theFolder to item i of thisProjList
				-- Invariant: at this point theParentPath exists and it is equal to theCurrentPath
				set theCurrentPath to theCurrentPath & theFolder & ":"
				if not (folder (theCurrentPath) exists) then
					make new folder at alias (theParentPath) with properties {name:theFolder}
					if linksInAllFolders then
						make new internet location file to item i of theLinkList at alias (theCurrentPath) with properties {name:linkPrefix & theFolder}
					end if
				end if
				set theParentPath to theCurrentPath
			end repeat
			-- Last folder (it may correspond to an OF folder or project)
			set theFolder to the last item of thisProjList
			set theLink to the last item of theLinkList
			set theCurrentPath to theCurrentPath & theFolder & ":"
			if not (folder (theCurrentPath) exists) then -- If we get here, this should always be true
				make new folder at alias (theParentPath) with properties {name:theFolder, comment:theStatus}
				--set theColor to projectLabel's theStatus
				--set label index of the result to theColor
				if isProjectFolder or linksInAllFolders then
					make new internet location file to theLink at alias (theCurrentPath) with properties {name:linkPrefix & theFolder}
				end if
				if isProjectFolder and createOODocument then
					set projNotesName to ooPrefix & theFolder & ooSuffix & ooExtension
					tell application "OmniOutliner"
						set notesDoc to make new document with properties {name:projNotesName}
						save notesDoc in theCurrentPath & projNotesName
						close notesDoc
					end tell
				end if
			end if
			open folder (theCurrentPath)
		on error
			return
		end try
	end try
	-- Resize the window
	set {d1, d2, monitor_width, monitor_height} to desktop's window's bounds
	set hh to (monitor_height - topoff - bottomoff) -- / 2
	set bounds of the front window to {0, topoff, monitor_width, topoff + hh}
	set current view of the front window to list view
end tell