Hi Carlos,
Thank you for clarifying, I got confused by the documentation which seems to suggest a return type:

I can now convert area text to point text but I still have problems picking up the width (and height if that is possible) of the point text.
My artboard looks like this when the text is still area text:

My layer structure looks like this:

And my code like this. I get an error when I try to remove the duplicate which I converted to point text. And the rectangles don't pick up the new size but stick to the old size.
for (var i = 0; i < myDocument.layers["Text"].pageItems.length; i++)
{
var vParent = myDocument.layers["Text"].pageItems[i]; // get the elements of the group
var vNumbers = vParent.pageItems.length; // numbers of elements
for ( var j = vNumbers - 1; j >= 0 ; j-- ) {
var vChild = vParent.pageItems[j];
var vPointTextCopy = vChild.duplicate();
var gB = vPointTextCopy.geometricBounds; // left, top, right, bottom
var w = Math.abs(gB[2] - gB[0]);
var h = Math.abs(gB[3] - gB[1]);
var top = gB[1];
var left = gB[0];
app.redraw();
var rect = myDocument.layers["TestRectLayer"].pathItems.rectangle(top, left, w, h); // de oorsprong ligt linksonder
rect.name = "TestRect";
rect.stroked = true;
rect.filled = false;
rect.strokeWidth = 3;
rect.strokeColor = redColor;
vPointTextCopy.remove(); // throws an error
}
}
So I get:

And I'm stuck with the point text objects which I can't remove. It appears as if the pointers still point to the original objects.
Any help greatly appreciated.
// Tom
Hi Tom, I can replicate your issue, I checked my notes and in fact I had noticed the reference gets lost after converting to PointText but couldn't remember. Since the dup text frame gets selected after duplicating, we'll put this selection right back into our variable.
insert these two lines after duplicating your text frame
app.redraw();
vPointTextCopy = selection[0];
Let me know if that works, if not we'll look into other workarounds