Skip to main content
Known Participant
Nov 16, 2026 9:15 AM UTC
Answered

Extendscript: insertionPoints[0] question - help required please

Hi there,

I currently have a working script that I’d like to modify.

The script uses insertionPoints[0] to add a text box as an anchored item within a paragraph of text.

Is it possible to get x,y page coordinates for insertionPoints[0]? If so, please can someone show me how?

Rather than adding an anchored text box I’d like to be able to add a text box, to a different layer, at the current insertion point I already have.

Thank you :)

 

    Manan JoshiCorrect answer
    Community Expert
    Nov 16, 2026 9:27 AM UTC

    Something like the following may work

    var ip = app.selection[0].insertionPoints[0];

    var x = ip.horizontalOffset;
    var y = ip.baseline;

    alert("X: " + x + "\nY: " + y);

     

    -Manan

    3 replies

    Manan JoshiCommunity ExpertCorrect answer
    Community Expert
    Nov 16, 2026 9:27 AM UTC

    Something like the following may work

    var ip = app.selection[0].insertionPoints[0];

    var x = ip.horizontalOffset;
    var y = ip.baseline;

    alert("X: " + x + "\nY: " + y);

     

    Translate
    -Manan
    Known Participant
    Nov 16, 2026 9:39 AM UTC

    Wow! Thanks Manan :)

    I’ve just done a couple of quick tests and it seems to be giving me what I need.

    Thanks again :)

    Translate
    Community Expert
    Nov 16, 2026 9:42 AM UTC

    Good to know

    Translate
    -Manan