Copy link to clipboard
Copied
Hi!
I´ve written a simple script wich becomes part of a bigger one. Unfortunately it doesn´t work. And I cannot see the fault.
Okay, I´m a rookie, but this should not be too sophisticated.
var Auswahl = app.selection[0];
var rA=Auswahl.rotationAngle;
Auswahl.rotationAngle=0;
//var pName = Auswahl.parentPage.name;
var Koordinaten = Auswahl.geometricBounds;
var y0 = Koordinaten[0];
var x0 = Koordinaten[1];
var y1 = Koordinaten[2];
var x1 = Koordinaten[3];
//var tContent = Auswahl.texts.item(0);
//do calculations
var TxBreite = x1 - x0;
var TxHoehe = y1 - y0;
if (TxBreite < '50') {
Koordinaten[3] = Koordinaten[1]+'50';
}
//alert(Koordinaten[0]+" - "+Koordinaten[1]+" - "+Koordinaten[2]+" - "+Koordinaten[3]);
alert("Die Breite beträgt: "+TxBreite +"mm. \nDie Höhe beträgt: "+TxHoehe+"mm.");
The task is simple: select a textframe, get its width and height, if the width is less 50mm make it 50mm wide!
where is the bug?
Hi,
1. Use Numbers instead of String (especially when a +'b' is in use)
2. Assign value to entire property - not to part of it (Auswahl.geometricBounds = [y0,x0,y1,x0+50]
Jarek
Copy link to clipboard
Copied
Hi,
1. Use Numbers instead of String (especially when a +'b' is in use)
2. Assign value to entire property - not to part of it (Auswahl.geometricBounds = [y0,x0,y1,x0+50]
Jarek
Copy link to clipboard
Copied
Okay, that was it. Does it mean, that you cannot change only one coordinate of that bounds, but just all together?
Thanks, by the way!