2 Replies Latest reply on Feb 12, 2014 1:32 AM by roberto_zuc

    find a text frame on the page with script label

    roberto_zuc

      hello to all

       

       

      I need to create a script to

      find a text frame on the page with script label "xxx"

      and read its contents into a variable.

       

       

      The content of the text frame is a number.

       

       

      thanks

        • 1. Re: find a text frame on the page with script label
          Trevorׅ Adobe Community Professional

          Hi Roberto,

           

          Welcome to the forum,

           

          This will find the labeled textFrame on the active page.

           

          var myLabel = "Foo", // change to label
                myPage = app.properties.activeWindow && app.activeWindow.activePage,
                myTextFrames = myPage.textFrames.everyItem().getElements().slice(0),
                l = myTextFrames.length,
                myVariable
                
          while (l--) {
              if (myTextFrames[l].label != myLabel) continue;
              myVariable = myTextFrames[l].contents;
              break; // presuming there's only one "Foo" labeled frame on the page
              // Otherwise you'll nead an array
              }
          
          alert(myVariable)
             
          

           

           

          Trevor

          • 2. Re: find a text frame on the page with script label
            roberto_zuc Level 1

            Hello Trevor,

            I thank you for the suggestion, I have been very useful.

             

             

            Now I want to try to find other solutions to practice with writing javascript.

             

             

            Roberto