7 Replies Latest reply on Jun 2, 2014 10:21 PM by hasvi

    How to change my 'Anchored Object Option'

    hasvi Level 1

      Hi,

       

      How to change my 'Anchored Object Option' from 'Custom' to 'Inline' position.

       

      this is my idea, Need script for this

       

      Preference.AnchoredObjectSetting.anchoredPosition.AnchorPosition.INLINE_POSITION.

       

       

      by

      hasvi

        • 1. Re: How to change my 'Anchored Object Option'
          csm_phil Level 4

          Hi hasvi,

           

          Try the below line.

           

          app.selection[0].anchoredObjectSettings.anchoredPosition = AnchorPosition.INLINE_POSITION;
          

           

           

          I requested to you, You posted so many threads in the  forum, but your are not closed the thread once you get the solution is "helpful or answered". Please try to keep this activities in future. 

           

          thx,

          csm_phil

          • 2. Re: How to change my 'Anchored Object Option'
            Laubender Adobe Community Professional & MVP

            @Hasvi – Assign the desired anchoring features to a pageItem with the GUI in InDesign. Then loop through all properties and their possible values of anchoredObjectSettings of that specific pageItem.

             

            Also see DOM documentation by Jongware to get an overview, especially see enumerators for some availabel values.

             

            var myRectangle = app.documents[0].textFrames[0].parentStory.rectangles[0];
            
            var myObject = myRectangle.anchoredObjectSettings;
            
            for(x in myObject){
                $.writeln(x+"\t"+myObject[x]);
                };
            /*
               
            Just an example of a specific rectangle anchored:
            RESULTS:
            
            //The numbers like 1095716969 indicate an Enumerator
            //A fixed value for a specific option:
            
            //1095716969 stands for:
            //AnchorPosition.INLINE_POSITION
            
            anchoredPosition    1095716969
            spineRelative    false
            lockPosition    false
            pinPosition    true
            anchorPoint    1095656050
            horizontalAlignment    1818584692
            horizontalReferencePoint    1954051174
            verticalAlignment    1651471469
            verticalReferencePoint    1096180321
            anchorXoffset    0
            anchorYoffset    0
            anchorSpaceAbove    0
            isValid    true
            parent    [object Rectangle]
            properties    [object Object]
            events    [object Events]
            eventListeners    [object EventListeners]
            isValid    true
            
            */
            

             

            Look up the proper values, if your rectangle in that code is already anchored like you want it.

             

            Uwe

            • 3. Re: How to change my 'Anchored Object Option'
              hasvi Level 1

              Hi,

               

              Where is the option of "helpful or answered". And how to close our threads, Pls explain or show me the snapshot.

               

              by

              hasvi

              • 4. Re: How to change my 'Anchored Object Option'
                Laubender Adobe Community Professional & MVP

                "Helpful" is gone for average forum members since Adobe changed the Forum software to Jive 7. Only Forum Moderators can apply a "Helpful" to an answer now (at least this is the thing I read over in the Forum about the Forums; I'm no moderator so cannot tell exactly).

                "Answered" should be visible, if you log in to the Forum Software. Not available when using E-Mail…

                 

                Uwe

                • 5. Re: How to change my 'Anchored Object Option'
                  hasvi Level 1

                  Hi Uwe,

                   

                  I have run your code:

                  1. var myRectangle = app.documents[0].textFrames[0].parentStory.rectangles[0]; 
                  2.  
                  3. var myObject = myRectangle.anchoredObjectSettings; 
                  4.  
                  5. for(x in myObject){ 
                  6.     $.writeln(x+"\t"+myObject[x]); 
                  7.     }; 

                  but I am not clear with this, if I run this script nothing happened, can you explain for me? And what is the 'GUI in InDesign', you mean get the id value from below script:


                  app.menuActions.itemByID(24833).invoke(); 


                  by

                  hasvi

                  • 6. Re: How to change my 'Anchored Object Option'
                    Laubender Adobe Community Professional & MVP

                    @Hasvi – the point is: Do it in the Graphical User Interface (GUI) first. Without a script.

                    Construct one document with one page with one textframe where one anchored object is obscuring the exact amount of text you want. And the exact position where you want it.

                     

                    Then run this code above from the ESTK (ExtendScript Toolkit app or exe (if on Windows)).

                     

                    The result will be written to the JavaScript console of the ESTK and you can copy/paste it for your purpose:
                    Using the same properties and values for your rectangles you want to anchor.

                     

                    The relevant properties are:

                     

                    anchoredPosition

                    spineRelative

                    lockPosition

                    pinPosition

                    anchorPoint

                    horizontalAlignment

                    horizontalReferencePoint

                    verticalAlignment

                    verticalReferencePoint

                    anchorXoffset

                    anchorYoffset

                    anchorSpaceAbove

                     

                    Their values will be different from mine, because you have specific needs.

                    You can apply them individually after you created your rectangle with the add() method at a certain insertion point.

                    Or use a predefined Object Style you created in the GUI of InDesign without script.

                     

                    Details here:

                     

                    Adobe InDesign CS6 (8.0) Object Model JS: AnchoredObjectSetting

                     

                    It's best to download the CHM version of the DOM (Document Object Model) provided by Jongware:

                     

                    Jongware

                    InDesign JavaScript Reference Guide

                     

                    Indesign JavaScript Help

                     

                    Uwe

                    • 7. Re: How to change my 'Anchored Object Option'
                      hasvi Level 1

                      Hi Uwe,

                       

                      thanks for your valuable answer.

                      by

                      hasvi