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

for-looping Through All textFrames (cs4 jsx)

Community Beginner ,
May 02, 2011 May 02, 2011

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!

TOPICS
Scripting
741
Translate
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

Community Expert , May 02, 2011 May 02, 2011

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

}
Translate
Adobe
Community Expert ,
May 02, 2011 May 02, 2011

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

}
Translate
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
Community Beginner ,
May 02, 2011 May 02, 2011
LATEST

missing the s, unbelievable.  Thank you!

Translate
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