i have the same problem.
i fount the same script. tried it directly in to python, but no luck. and i don't have the capability to change the script.
does maybe somebody can translate the coffee script to a python script ( i'm not even knowing if that is possible)
main(doc,op)
{
var obj;
var next;
for (obj = op->GetDown(); obj; obj = obj->GetNext())
{
if (!obj->GetNext()) break;
}
var last = obj;
for (obj = op->GetDown(); obj; obj = next)
{
next = obj->GetNext();
obj->Remove();
doc->InsertObject(obj, op, NULL);
if (obj == last) break;
}
}