The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus Extras (http://forums.omnigroup.com/forumdisplay.php?f=44)
-   -   Open or Create Project Folder Script (http://forums.omnigroup.com/showthread.php?t=9322)

ptone 2008-08-11 11:17 AM

Open or Create Project Folder Script
 
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[/CODE]


All times are GMT -8. The time now is 06:06 PM.

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