Skip to main content
Participating Frequently
April 4, 2016
Answered

select a text frame with lable

  • April 4, 2016
  • 1 reply
  • 392 views

I am trying to catch a text frame from document page 2 with script label "main text" but below script is not working.

app.activeDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points;

app.activeDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.points;

app.activeDocument.viewPreferences.rulerOrigin = RulerOrigin.spreadOrigin;

try

{

var jt=app.activeDocument.pages[2].textFrames;

for (i=0;i<jt.length;i++)

if (jt.label=="Main Text")

jt.TextFramePreference.autoSizingType=AutoSizingTypeEnum.HEIGHT_ONLY;

}

catch(e){

    alert("nothing happened");

    }

Can some one please help me what is the error here.

This topic has been closed for replies.
Correct answer Laubender

Counting with index numbers starts with number 0.

So the second page is app.documents[0].pages[1].

Uwe

1 reply

LaubenderCommunity ExpertCorrect answer
Community Expert
April 4, 2016

Counting with index numbers starts with number 0.

So the second page is app.documents[0].pages[1].

Uwe

Participating Frequently
April 4, 2016

Thanks a lot!

You opened my eye in my today's mess up!