Skip to main content
Known Participant
June 18, 2013
Question

move the geometricBounds using condition

  • June 18, 2013
  • 1 reply
  • 1298 views

Hello forum,

May i get a help from you.

I m trying to maintain only the geometricBound[2] (top of the frame) and moving all the 3 sides of the frame towards Bleed..

my simple english style script is..

(trying to keep the Top frame position as it and move all the 3 geometric Bounds towards the Bleed).

How Can i check using  if condition that all the 3 frames are to touching Marings, like below. and if so move them towards bleed.Do not move the frame if it is not touching the maring.

if (app.selection[0].geometricBounds == [pageBounds[0]-maringBottom, pageBounds[1]+marginLeft, app.selection[0].geometricBounds[2], pageBounds[3]-marginRight])

{

app.selection[0].geometricBounds = [pageBounds[0]+bottomBleed, pageBounds[1]-bleedLeft, app.selection[0].geometricBounds[2], pageBounds[3]+bleedRight]

Please help on this forum.

Dhinak..

This topic has been closed for replies.

1 reply

Wander5Author
Known Participant
June 19, 2013

Hi forum,

Any help on this please. As it will save my lot of time..

thanks

Wander5Author
Known Participant
June 19, 2013

Hi Forum,

I also tried like this, (modify the frame geometricbounds, bottom bounds which touch the bottom margin, left bound which touch the leftmargin and right bound which touches the right margin.)

but the script adjust the any frame which does matches the above conditions.

//var pI = app.activeDocument.pages.item(0).pageItems.lastItem();

slu = app.activeDocument.documentPreferences;

pB = app.activeDocument.pages.item(0).bounds[0];

pL = app.activeDocument.pages.item(0).bounds[1];

pT = app.activeDocument.pages.item(0).bounds[2];

pR = app.activeDocument.pages.item(0).bounds[3];

mL = app.activeDocument.pages.item(0).marginPreferences.left;

mR = app.activeDocument.pages.item(0).marginPreferences.right;

mT = app.activeDocument.pages.item(0).marginPreferences.top;

mB = app.activeDocument.pages.item(0).marginPreferences.bottom;

bT = app.activeDocument.documentPreferences.documentBleedTopOffset;

bB = app.activeDocument.documentPreferences.documentBleedBottomOffset;

bL = app.activeDocument.documentPreferences.documentBleedInsideOrLeftOffset;

bR = app.activeDocument.documentPreferences.documentBleedOutsideOrRightOffset;

pH = app.activeDocument.documentPreferences.pageHeight;

pW = app.activeDocument.documentPreferences.pageWidth;

sH = app.selection[0].visibleBounds[2]-app.selection[0].visibleBounds[0];

if (app.selection[0].geometricBounds == [app.selection[0].visibleBounds[0], pL+mL, pH-app.selection[0].geometricBounds[1], pR-mR]) {

app.selection[0].geometricBounds = [app.selection[0].visibleBounds[0], pL-bL, app.selection[0].visibleBounds[2]+mB+bB, pR+bR]  // modifying the bounds left , right and bottom to touch the bleed left, right and bottom, without disturbing the top bound.

}

Jongware
Community Expert
Community Expert
June 19, 2013

Good attempts, and you are generally heading into the right direction. However, one of your primary assumptions is wrong:

you cannot compare two arrays.

See http://stackoverflow.com/questions/7837456/comparing-two-arrays-in-javascript for some clues.