View Single Post
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:

Code:
/Users/mylogin/GTD
                        /Work
                            /project 1
                            /projetc 2
                            ...etc..
                        /Home
                            /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!)
Code:
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

Last edited by ptorngaard; 2009-03-08 at 01:59 PM..