The Omni Group Forums

The Omni Group Forums (
-   OmniFocus Extras (
-   -   Apple script for keeping project names in sync (

ptorngaard 2009-03-08 05:49 AM

Apple script for keeping project names in sync
Being the novice AS programmer that I am - I'd like to hear if anyone else have solve my problem.

I'd like to keep the project names in OF in sync with the same project folders in my filesystem. So all my reference material for a given project can find a safe place in the filesystem.

I'm able to pass the project names from OF but no able to manage the verification and/or creation of folders in the filesystem. My GTD project structure looks like the following:

/project 1
/projetc 2
/projetc 4
/projetc 5
The same structure is in OF where I have to top level containers one for all Work related projects and one for all Home related ones. So it's the creation of the folder structure that matches the structure in OF that I'm struggling with. Cannot seem to get Finder to understand the path that I'm creating on the fly - so if anyone has ideas I'd like to see them.

Here is the code (what I managed to get done now!)
on verify_folder(folder_type, folder_name)
set myGTD to path to home folder
set myGTD to folder of "GTD" of folder myGTD
tell application "Finder"
--log myGTD
make new folder at (myGTD & folder_type) with properties {name:folder_name}
end tell
end verify_folder

tell application "OmniFocus"
tell default document
set numProjects to (count projects)

-- process folders if there are any
set numFolders to (count folders)
repeat with nf from 1 to numFolders
set folderName to name of folder nf
set subProj to ((count projects) of folder nf)
repeat with sp from 1 to subProj
set pstatus to status of project sp of folder nf
if pstatus = active then
set pname to name of project sp of folder nf
verify_folder(folderName, pname) of me
end if
end repeat
end repeat
end tell
end tell

ptorngaard 2009-03-08 02:00 PM

Just found [URL=""][/URL] that kind of provided me with a solution ....

All times are GMT -8. The time now is 02:28 AM.

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