Quantcast
Channel: Adobe Community : Popular Discussions - InDesign Scripting
Viewing all articles
Browse latest Browse all 15932

Change X, Y position of a text frame based on some conditions

$
0
0

Hi All,

 

I am trying to re-position the Y position alone of all text frames in a documennt if that text frame has certain Y position. Here is the code I tried.

 

It works, but, it place all the text frames in to the given myTextFrame.move ( ["216.425 pt","54 pt"] ); one on another. Whereas, I need to change Y position of only the text frames with the following conditions.

 

The conditions are:

 

If X="216.425 pt" AND Y="103.89 pt", change to X="216.425 pt" and Y="54 pt"   OR

If X="216.425 pt" AND Y="78.945 pt", change to X="216.425 pt" and Y="54 pt"    OR

If X="216.425 pt" AND Y="79.157 pt", change to X="216.425 pt" and Y="54 pt"    OR

If X="213.425 pt" AND Y="486.647 pt", change to X="216.425 pt" and Y="54 pt"    OR

If X="213.425 pt" AND Y="74.409 pt", change to X="216.425 pt" and Y="54 pt"   

 

   

Please help me on this to add the above conditions into the following code and reposition only the text frames has the above said XY positions.  Is there anyother way other than "move" statement?

 

 

var myDocument=app.activeDocument;

var myPages=myDocument.pages;

    for(p=0;p<myPages.length;p++) {

 

    var allTextFrames=myPages[p].textFrames;

        for (s=0; s<allTextFrames.length; s++) {

                    var myTextFrame = allTextFrames[s];

                    var myTextFrameBounds =  myTextFrame.geometricBounds;

                    var properly_aligned = "54 pt";

                        if ((myTextFrameBounds[0] = "103.89 pt") && (myTextFrameBounds[1] ="216.425 pt")) {

                            myTextFrame.move ( ["216.425 pt","54 pt"] );

 

                         }  

                                                       

                }

    }


Viewing all articles
Browse latest Browse all 15932

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>