Cheers mate.
I'll do the annoying thing of answering your question with a question. Do you really need to move the origin and potentially complicate/break other actions/calculations? If you know exactly where the program sets the origin by default, can you not write your calculations based around that?
Also, did you intentionally write "upper right" in reference to the origin? I ask because the origin was previously in the bottom left and is now in the top left.
You are right. Illustrator scripting is not so comfortable as in other programs.
brianp311 wrote:
"… So is there any way, if a doc was created dynamically, to revert the y-axis to the upper right? Can I change the page origin property? "
Changing this property or reverting the y-axis causes other problems - which you don't want!
That's why:
TextFrames.add() creates a new text frames with anchorpoint [0,0] for the baseline of that frame.
Sure - the easiest way for moving the text frame to the bottom - seems to be to use the position property with a negativ y-value --> TextFrame.position[72, -2448]
tf.position = [72, -2448];
But there is one problem with this method: position values are [left, top]. And using this property - now the top of your text frame will be at position -2448pt (34in) and not longer the baseline. And I'm very sure, that is also not what you really want. Because of your text frame will be (at the bottom) outside of your artboard.
Assumed you want a text frame with font-baseline-anchorpoint-position [72, -2448]
Create the textframe and move it with translate method. Use the artboardRect values for exact positioning.
For example -->
var aDoc = app.activeDocument;
var ABR = aDoc.artboards[0].artboardRect;
var tf = aDoc.activeLayer.textFrames.add();
tf.contents = "abcdefg";
tf.translate(72, ABR[3]);
Have fun
😉