2 Replies Latest reply on Dec 13, 2012 3:31 AM by sshunho

    How do I align a placed image in a frame using JS?


      I am new both to javascript and to scripting for InDesign, so please bear with me on this question.


      I am trying to align an image in a graphic frame so it aligns to the top right corner of the frame.


      I can do this using the InDesign interface by following these steps:


      1. Create a rectangular frame.

      2. Right-clicking the frame and selecting "Fitting > Frame Fitting Options."


      3. Selecting the top-right square in the "Alignment" area of the Frame Fitting Options dialogue.

      Frame Fitting Options Menu.jpg


      For me, this automatically aligns the image to the top right corner in the selected text frame, even if there is a placed item in the frame.


      I am trying to apply this to the actual image frame using the following code where "modelFrame" is the rectangle that is the parent of the placed image:


                modelFrame.frameFittingOptions.fittingAlignment.anchorPoint = AnchorPoint.TOP_RIGHT_ANCHOR;


      I am not getting an error, but I am also not getting the desired results (in fact, it doesn't change anythign at all). What am I doing wrong?