2 Replies Latest reply on Dec 12, 2014 3:00 PM by Ricardo85x

    getting anchoredPosition

    wokoman1234 Level 1

      Hi there,

       

      having some issues with anchored objects that drive me mad, probably overlooking something very simple but can't find it back.

       

      My target is pretty simple to explain : For every anchored object on my document I want to release it, do something with it, and place it back in the same position with the same settings as the original anchor.

       

      In practice this seems to be quite complex, take following script

       

      var myAnchor = app.selection[0];
      var myAnchorPosition = myAnchor.anchoredObjectSettings.anchoredPosition;
      
      switch(myAnchorPosition )
      {
      case "INLINE_POSITION":
          alert("Inline");
           // get inline settings
          break;
      
      case "ABOVE_LINE":
          alert("Above");
           // get above line settings
          break;
      
      case "ANCHORED":
          alert("Custom");
           // get custom settings
          break;
      
      default :
          alert(myAnchorPosition );
           // Aaargh, why do I keep ending up here ???
          break;
      }
      

       

      While my alert(myAnchorPosition ) is showing each time either "INLINE_POSITION" or "ABOVE_LINE" or "ANCHORED", it is simply ignored in my switch, it's always going to the default value. So any idea what I am doing wrong here ?

        • 1. Re: getting anchoredPosition
          -hans- Level 4

          Hi,

           

          result is not a string. try:

           

          var myAnchor = app.selection[0];
          var myAnchorPosition = myAnchor.anchoredObjectSettings.anchoredPosition;
          
          switch(myAnchorPosition )
          {
          case AnchorPosition.INLINE_POSITION:
              alert("Inline");
               // get inline settings
              break;
          
          case AnchorPosition.ABOVE_LINE:
              alert("Above");
               // get above line settings
              break;
          
          case AnchorPosition.ANCHORED:
              alert("Custom");
               // get custom settings
              break;
          
          default :     break;
          }
          

          Hans-Gerd Claßen

          • 2. Re: getting anchoredPosition
            Ricardo85x

            Hi

             

            I need the same thing.

             

            But this code does not work on indesign CS 6 or CC 2014

             

            I got the message:

             

            Error: The property is not applicable in the current state.

             

             

            Could you help me?