• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

textframe width : get it - check minimum - apply new

Engaged ,
Oct 23, 2016 Oct 23, 2016

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?

TOPICS
Scripting

Views

298

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Mentor , Oct 23, 2016 Oct 23, 2016

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

Votes

Translate

Translate
Mentor ,
Oct 23, 2016 Oct 23, 2016

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Oct 23, 2016 Oct 23, 2016

Copy link to clipboard

Copied

LATEST

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!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines