PDA

View Full Version : Join Projects class Otco error


somedude
2008-03-31, 02:45 PM
I'm using the OmniPlan trial (tried 1.5.0 / 1.5.1 rc1) and wanted to use the Join Projects script to merge a couple of my schedules.

I've tried joining small schedules (less than 10 tasks/subtasks each), and purely test schedules of 3-4 tasks each, but get the same error:

The script 'Join Projects' could not complete.

AppleScript reported the following error:
OmniPlan got an error: Can't get <<class Otco>> of item 1 of every child task of project of document id "91DC1FFE-...".

Any ideas? I'm considering purchasing OmniPlan if this works out.

Thanks a bunch.

Lizard
2008-04-01, 11:18 AM
You can fix the script by opening it in Script Editor, and changing the two places where "<<class Otco>>" occurs to "completed".

However, this script was mostly created as a temporary workaround until 1.5 was released. Now you can accomplish essentially the same thing just by dragging tasks from one project to another. (In 1.1, that would only copy the tasks, but now it also brings their resource assignments.)

somedude
2008-04-04, 12:40 PM
Thanks this worked.

What I'd ideally want to do is automatically take a folder of individual schedules and combine them into one master schedule, then use filters to produce a schedule specific to each resource. Dragging and dropping is too much work for doing this whenever an individual schedule updates or for working with many schedules.

Is there a way to easily change this script so that it loops through a whole folder, instead of joining a single file?

Thanks!

Lizard
2008-04-04, 03:58 PM
That should be fairly straightforward.

On line 400, change "choose file" to "choose folder"
Then wrap everything from lines 405 to 472 in a repeat block something like
repeat with thisFile in items of sourceInfo whose kind is "OmniPlan"
and then change all occurrences of sourceInfo inside that block to thisFile

somedude
2008-04-07, 12:01 PM
I tried this, but got an error on the new repeat line:

The variable sourceInfo is not defined.

somedude
2008-04-07, 12:08 PM
Just in case it helps, here's what the lines in question look like after modification:

if my onlyShowOmniPlanFilesInOpenDialog then
set sourceAlias to choose file with prompt "Source project to import contents from:" of type {"com.omnigroup.omniplan.planfile"} without invisibles
else
set sourceAlias to choose folder with prompt "Source project to import contents from:" without invisibles
end if

repeat with thisFile in (items of sourceInfo whose kind is "OmniPlan")
-- sneaky trick to prevent quirks that occur when two OmniPlan files have the same uuid. Generate a new file using the original as a template will force a new unique id.
set thisFile to info for sourceAlias
if kind of thisFile is "OmniPlan" then
set t to POSIX path of sourceAlias
set sourceDoc to make new document with properties {template:t}
set sourceName to name of thisFile


... and I ended the repeat before the end tell on the last line of the script.

Thanks for all the help.

Lizard
2008-04-07, 01:52 PM
set thisFile to info for sourceAlias

should be before the repeat and changed back to

set sourceInfo to info for sourceAlias

somedude
2008-04-07, 04:03 PM
I made the changes and got this error:

The script 'Join Projects' could not complete.
AppleScript reported the following error:
Can’t get {"micro schedules", date "Monday, April 7, 2008 12:36:27 PM", date "Monday, April 7, 2008 12:36:38 PM", 82593, true, false, false, true, false, missing value, "micro schedules", alias "Test Leopard Server Standard:System:Library:CoreServices:Finder.app:", "Folder", {0, 0, 0, 0}, "", ""} whose «class kind» of it = "OmniPlan".

Lizard
2008-04-08, 05:42 PM
This is what I get for not trying out a solution before telling it to you.

I'm having a bit of a fight with Finder's applescript interface trying to fix it the way I told you. So here's a simpler, yet slightly less convenient way. You'll have to select all the projects in the choose dialog, but it means it works.

tbo
2010-02-17, 11:12 AM
Thanks for the script. It did the trick. Great! Let's see what OmniPlan 2 comes up with...