The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus Extras (http://forums.omnigroup.com/forumdisplay.php?f=44)
-   -   Apple script for keeping project names in sync (http://forums.omnigroup.com/showthread.php?t=11527)

ptorngaard 2009-03-08 04: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:

[CODE]
/Users/mylogin/GTD
/Work
/project 1
/projetc 2
...etc..
/Home
/projetc 4
/projetc 5
[/CODE]
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
[/CODE]

ptorngaard 2009-03-08 01:00 PM

Just found [URL="http://forums.omnigroup.com/showthread.php?t=10863"]http://forums.omnigroup.com/showthread.php?t=10863[/URL] that kind of provided me with a solution ....


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

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