select a text frame with lable
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.