15 Replies Latest reply on Aug 29, 2012 10:42 AM by Trevorׅ

    Export frame inside frame

    piggychops

      Hello

       

      I want to export the frames/images which are inside the text frames or any other frames. I dont have the idea how to get it.

       

      Can anyone please help me on this.

        • 1. Re: Export frame inside frame
          -hans- Level 4

          Hi,

           

          frames or images¿

          Access to images (and more ...) should be:  app, document, allGraphics ...

          indentifying of 'frames which are inside the text frames or any other frames' should be achieved by objects 'parent' ...

          • 2. Re: Export frame inside frame
            piggychops Level 1

            Hi,

             

            For me images are getting exported but the thing is those images having button property. Now they will not retain that properties while exporting. I want to retain the button property. Any idea.

            • 3. Re: Export frame inside frame
              -hans- Level 4

              Hi,

              app.activeDocuments.buttons
              

              should return a list of ... ;-)

               

              exportFile'll work on it .

              • 4. Re: Export frame inside frame
                piggychops Level 1

                Hi,

                 

                What i am trying to do is something different. From the above code i can get the buttons which are not inside any frame. But what i am trying to do is, i have to put the buttons inside one frame using Paste Into in Indesign, those buttons i can not able to get it.

                • 5. Re: Export frame inside frame
                  -hans- Level 4

                  Hi,

                   

                  you'll use allPage Items to get Objects inside of frames ...

                   

                   

                  var collectObjects = app.activeDocument.allPageItems;
                  var myButtons = [];
                  
                  for (var i = 0; i < collectObjects.length; i++)
                  {
                  if(collectObjects[i].hasOwnProperty('activeStateIndex')) //may be another interactive property is more useful ... don't know
                  {
                      myButtons.push(collectObjects[i])
                  alert('here it is your button')    
                  collectObjects[i].select()
                      }
                          }
                  

                   

                  Hope I got you right (seems as if both of us are just having basically english skills ;-) )

                  • 6. Re: Export frame inside frame
                    Trevorׅ Adobe Community Professional

                    To understand this make a doc with 3 buttons, 2 as regular buttons and 1 as an ancored object in a text frame.

                     

                    The following lines should be entered one at a time in the js console.

                     

                    app.documents[0].buttons.everyItem().fillColor="Black"
                    app.documents[0].stories.everyItem().buttons.everyItem().fillColor="Black"
                    app.documents[0].stories[0].buttons[0].fillColor="Paper"
                    app.documents[0].buttons.length
                    app.documents[0].stories.everyItem().buttons.length
                    

                     

                     

                    You should be able to figure out the rest by yourself

                     

                    Trevor

                    • 7. Re: Export frame inside frame
                      piggychops Level 1

                      Hi,

                       

                      Thank you. Its working fine

                      • 8. Re: Export frame inside frame
                        Trevorׅ Adobe Community Professional

                        I realy think

                         

                        myButtons=app.documents[0].stories.everyItem().buttons;
                        

                        Is a much better way of getting a collection of the buttons in text boxes.

                         

                        I you want an array of all buttons then you can do this

                         

                        myButtons=[];
                        myButtons[0]=app.documents[0].stories.everyItem().buttons ;
                        myButtons[1]=app.documents[0].buttons;
                        

                         

                        Like this you don't waist the computers precious brain power on going though every page item and checking whether or now it is a button or not!

                         

                        Either way you  should mark what you consider as the correct answer.

                         

                        Trevor

                        • 9. Re: Export frame inside frame
                          -hans- Level 4

                          Hi,

                           

                          as discribed in the first post a button can also be inside (masked) a nontextframe ...

                          • 10. Re: Export frame inside frame
                            Laubender Adobe Community Professional & MVP
                            if(collectObjects[i].hasOwnProperty('activeStateIndex'))
                            //may be another interactive property is more useful ... don't know
                            

                             

                            @ -hans-, unfortunately "activeStateIndex" alone is not sufficent to identify a "Button" object.

                            Depending on the InDesign version, also "MultiStateIndex" and "FormField" owns this property.

                             

                            For InDesign CS6, there are 9 objects listed that own this property:

                             

                            Button*

                            CheckBox

                            ComboBox

                            FormField*

                            ListBox

                            MultiStateObject*

                            RadioButton

                            SignitureField

                            TextBox

                             

                            * CS5 or CS6

                             

                            So we need another identifier or even several identifiers in conjunction for filtering out the "Buttons".

                            OR: we need a new method …

                             

                            Uwe

                            • 11. Re: Export frame inside frame
                              Trevorׅ Adobe Community Professional

                              Yes,

                              I did miss that point.

                              One could add

                              myButtons[2]=app.documents[0].splineItems.everyItem().buttons ;

                               

                              But then you would rightly say to me what about spline items which contain buttons which are in a table cell

                               

                              myButtons=app.documents[0].stories.everyItem().tables.everyItem().cells.everyItem().button s.everyItem();

                               

                              So I guess you method is better better

                               

                              Regarding Uwe's comment

                              Best to use

                              if (myButtons[c].constructor.name=="Button")

                              I think that one is unique to buttons

                               

                              But I do think their must be a better way of doing this

                               

                              Trevor

                              • 12. Re: Export frame inside frame
                                Trevorׅ Adobe Community Professional

                                Laubender wrote:

                                 

                                OR: we need a new method …

                                 

                                Just incase I didn't make myself clear in my above post, I want to second Uwe's second motion.

                                • 13. Re: Export frame inside frame
                                  Laubender Adobe Community Professional & MVP

                                  @ Trevor && @-hans-,

                                   

                                  The name "allPageItems" is quite misleading…

                                   

                                  "myDocument.allPageItems" together with "constructor.name === "Button"" will NOT get every button, if you consider "MultiStateObject" objects.

                                  The thing is, that all "pageItems" that are NOT in the active state of a "MultiStateObject" will NOT be listed in "myDocument.allPageItems".

                                   

                                  In that case we would need to cycle through all MSOs and make all states one after another to the active state and collect the "Button" objects (best would be to collect them by their IDs) during that journey…

                                   

                                  And afterwards cycle through that array and access the buttons with:

                                  "myDocument.pageItems.itemByID(CollectedButtonIDs[n]).mySuperDuperExportMethod()".

                                   

                                  Oh what a drag…

                                   

                                  Uwe

                                  • 14. Re: Export frame inside frame
                                    Laubender Adobe Community Professional & MVP

                                    Another idea to get all the buttons; or better put: a slim straw of hope we can grab to circumvent the "MultiStateObject" problem I layed out in  post #13 (sic!).

                                     

                                    If all the buttons have a common texts property (and no other object in the document!), we could do a GREP or TEXT search to single out the buttons. GREP and TEXT searches will find every texts object, even in not active states of MultiStateObjects!!

                                     

                                    We then could climb from these results "upward" with "myResult[n].parentTextFrame.parent … parent" and check for "constructor.name === "Button" to the Button itself and store its ID in an array.

                                     

                                    And afterwards cycle through that array and access the buttons with:

                                    "myDocument.pageItems.itemByID(CollectedButtonIDs[n]).mySuperDuperExportMethod()".

                                     

                                    How about that?

                                     

                                    Um, well, is the OP still with us? ;-)

                                     

                                    Uwe

                                    • 15. Re: Export frame inside frame
                                      Trevorׅ Adobe Community Professional

                                      Laubender wrote:

                                       

                                       

                                      If all the buttons have a common texts property (and no other object in the document!), we could do a GREP or TEXT search to single out the buttons. GREP and TEXT searches will find every texts object, even in not active states of MultiStateObjects!!

                                       

                                       

                                      Wow, that's a mighty big if .

                                       

                                      But if we got all the buttons and stuck a common unique text property in them, we could then use a Grep or text search to find them