Copy link to clipboard
Copied
var docRef = app.activeDocument;
for (var num=0; num<docRef.textFrame.length; num++){
alert( docRef.textFrames[num] );
}
I would like to for through all of the text frames in a document to experiment with what properties return what information. I have a simple test document with like three different text frames, and I want to collect info on each one. This for loop doesn't seem to work though, and I can't quite wrap my head around how the textFrame and textFrames objects work.
Thanks for the assistance!
textFrames = a collection of textFrames
textFrame = a single textFrame, for example textFrames[1] refers to the second textFrame
try this
var docRef = app.activeDocument;
for (var num=0; num<docRef.textFrames.length; num++){ // you were missing an s
alert( docRef.textFrames[num]); // returns the object itself
alert( docRef.textFrames[num].contents ); // returns a property (contents) of the object
}
Copy link to clipboard
Copied
textFrames = a collection of textFrames
textFrame = a single textFrame, for example textFrames[1] refers to the second textFrame
try this
var docRef = app.activeDocument;
for (var num=0; num<docRef.textFrames.length; num++){ // you were missing an s
alert( docRef.textFrames[num]); // returns the object itself
alert( docRef.textFrames[num].contents ); // returns a property (contents) of the object
}
Copy link to clipboard
Copied
missing the s, unbelievable. Thank you!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now