The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus Extras (http://forums.omnigroup.com/forumdisplay.php?f=44)
-   -   Applescript to change the Project of a task? (http://forums.omnigroup.com/showthread.php?t=22916)

Kha 2011-12-19 03:44 AM

Applescript to change the Project of a task?
 
Hi there,

I would like to know how to be able to change the project for an existing task. I have looked through the dictionary and found that tasks have "Container", "Containing document", and "Containing project", however, these are read-only.

Does anyone know of a way to do that?

RobTrew 2011-12-19 05:18 AM

You can [I]move[/I] a task into the task list of another project.

[CODE]tell application id "OFOC"
tell default document
-- SET UP TWO PROJECTS
repeat with strName in {"ProjB", "ProjA"}
set oProj to make new project with properties {name:strName} at beginning of projects
repeat with strTask in {"First", "Second"}
tell oProj to set oTask to make new task at end of tasks with properties {name:strTask & " task of " & name}
end repeat
end repeat

-- MOVE A TASK FROM ONE PROJECT TO ANOTHER
move oTask to end of tasks of second project
end tell
end tell[/CODE]

Kha 2011-12-19 02:10 PM

RobTrew, that was such an obvious way of doing it... My brain was looking for the hardest way of doing it while the right answer is right there.

Thanks a lot for your help buddy!


All times are GMT -8. The time now is 11:37 AM.

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