Member
2008-01-21, 07:31 PM
I get the error: "OmniFocus got an error: Attempted to move data objects to a nil container." (I am getting really sick of that *#$$ nil container.)
The best solution I have found so far is to move the project from its original position at the bottom of the list to the top level section containing the folder I want the project in, then to the second level section within that section, and so on until I get it to where I want to go:
Code:
-- treePath is a path like "{FolderTop: Folder level 2: etc}"; getPathParts turns it into a list: {"FolderTop", "Folder level 2", "etc"}; newTemplate is a project reference
on moveToSection(treePath, newTemplate)
tell application "OmniFocus"
tell front document
set treePathParts to my getPathParts(treePath)
try
move newTemplate to after (first section whose name is (item 1 of treePathParts))
set currentSection to (first section whose name is (item 1 of treePathParts))
on error
return false
end try
repeat with i from 2 to count of treePathParts
try
move newTemplate to after (first section of currentSection whose name is (item i of treePathParts))
set currentSection to (first section of currentSection whose name is (item i of treePathParts))
on error errMsg
return false
-- The one of the folders named does not exist
end try
end repeat
move newTemplate to after (last section of currentSection)
end tell
return currentSection
end tell
end moveToSection
It works, but it is really slow.
Last edited by rloconne; 2008-01-21 at 07:34 PM..