Quantcast
Channel: Adobe Community: Message List - InDesign Scripting
Viewing all articles
Browse latest Browse all 37788

Re: find and remove text frames with same geometricBounds

$
0
0

Hi,

 

I am trying to find and move text frames from one position to another. Below is the code I tried. I am using Indesign CS6, and nothing happened when this script was running. Can you please help me on this. Thanks.

 

var oldposition = [216.425, 103.89] // original position, upper left corner

var newposition = [216.425, 54] // new position, upper left corner

//var threshold = new UnitValue(1,"pt"); // threshold value

 

var myFrame = app.activeDocument.textFrames.everyItem().getElements();

 

for (var i=0; i<myFrame.length; i++){

//    if (Math.abs(myFrame[i].geometricBounds[1]-oldposition[0])<threshold &&Math.abs(myFrame[i].geometricBounds[0]-oldposition[1])<threshold ){

if (Math.round(myFrame[i].geometricBounds[1])==oldposition[0]&&Math.roun d(myFrame[i].geometricBounds[0])==oldposition[1]){

    myFrame[i].move(newposition);

    }

}


Viewing all articles
Browse latest Browse all 37788

Trending Articles