View Single Post
Save this as a toolbar or menu script. Select a task, and it will open (if exists) or offer to create (if it doesn't) a folder in /Users/you/Projects for the Parent Project of the currently selected task.



Code:
set currentUser to do shell script "whoami"

set projectFolder to "/Users/" & currentUser & "/Projects/"

tell application "OmniFocus"
	try
		set selectedTask to value of selected tree 1 of content of window 1
	on error
		--nothing selected
		beep
		return
	end try
	
	if containing project of selectedTask is not missing value then
		set pName to name of containing project of selectedTask
		
		
		set projPath to projectFolder & pName
		
		try
			set ls to do shell script "ls " & quoted form of projPath
		on error
			display dialog "Folder does not exist, create it?" buttons {"Yes", "No"} default button 1
			if button returned of result is "Yes" then
				do shell script "mkdir -p " & quoted form of projPath
			else
				return
			end if
		end try
		
		
		do shell script "open " & quoted form of projPath
		
	end if
	
end tell