9 Replies Latest reply on Mar 2, 2016 6:50 AM by emi_233

    how can I make the anchor object to span over two faced or sequencial pages if these anchor objects are texts?

    emi_233 Level 1

      this is an anchor object in the right side page, I want the anchor object to span to the next

      page with the red line link as we link the text boxes?

      Can we make this in indesign?Capture.JPG

        • 1. Re: how can I make the anchor object to span over two faced or sequencial pages if these anchor objects are texts?
          Laubender Adobe Community Professional & MVP

          Hi Emi,

          no, if we consider the plain user interface (UI).

           

          The answer is yes, but… with a workaround by scripting, that involves one step in the UI before and some steps after running the script.

          It may not fit the solution you might have hoped for.

           

          My script can only thread a new text frame to the anchored one. It does not automatically change the position, if the anchor is moving up or down and more or less text should be flow to the second frame. Also: You have to position the second frame after running the script to the next page.

           

          1. First select the anchored text frame.

          2. Then run the following ExtendScript (JavaScript)

          Now you have a second text frame that is threaded to the one that is anchored exactly on top of the one that is anchored.

          3. Position the new text frame on the next page by moving it to the next page.

           

          This solution is not automatic in the sense, that if the anchor point is moving up or down, that the anchored one is changing height and the new text frame is automatically changing height as well. Perhaps you can do this by using the controls for text fitting in the text frame options for the second frame. But some quick tests are showing this is not possible for the first anchored frame.

           

          Here is the script:

           

          // ReleaseAnchoredTextFrameThreadAndReanchor.jsx
          // Uwe Laubender
          // ExtendScript (JavaScript) for InDesign CS5.5 and above.
          
          /**
          * @@@BUILDINFO@@@ ReleaseAnchoredTextFrameThreadAndReanchor.jsx !Version! Wed Mar 02 2016 10:49:14 GMT+0100
          */
          
          app.doScript
              (
              
              releaseThreadReanchorTextFrame, 
              ScriptLanguage.JAVASCRIPT, 
              [],
              UndoModes.ENTIRE_SCRIPT, 
              "Release-Thread-ReAnchor TextFrame | SCRIPT"
              
              );
          
          
          function releaseThreadReanchorTextFrame()
          {
              // Some checks on document length:
              // If no document is open, nothing is done.
              if(app.documents.length == 0){return};
              // Some checks on the selected items:
              // If nothing is selected, nothing is done.
              if(app.selection.length == 0){return};
              // If no text frame that is anchored is selected, nothing is done:
              if
              (
                  app.selection.length != 1 
                  && app.selection[0].constructor.name != "TextFrame"
                  && app.selection[0].parent.constructor.name != "Character"
              ){return};
              
              // If the selected text frame is part of a story with more than one text frames, do nothing:
              if(app.selection[0].parentStory.textContainers.length != 1){return};
              
              // The selected text frame cached in a variable:
              var textFrame = app.selection[0];
              // The first insertion point of the anchor character in the main story cached in a variable:
              var insertionPoint = textFrame.parent.parentStory.insertionPoints[app.selection[0].parent.index];
              
              // Various property/value pairs of the settings of the anchored object cached in variables:
              var anchorPoint = textFrame.anchoredObjectSettings.anchorPoint;
              var anchorXoffset = textFrame.anchoredObjectSettings.anchorXoffset;
              var anchorYoffset = textFrame.anchoredObjectSettings.anchorYoffset;
              var anchoredPosition = textFrame.anchoredObjectSettings.anchoredPosition;
              var horizontalAlignment = textFrame.anchoredObjectSettings.horizontalAlignment;
              var horizontalReferencePoint = textFrame.anchoredObjectSettings.horizontalReferencePoint;
              var pinPosition = textFrame.anchoredObjectSettings.pinPosition;
              var spineRelative = textFrame.anchoredObjectSettings.spineRelative;
              var verticalAlignment = textFrame.anchoredObjectSettings.verticalAlignment;
              var verticalReferencePoint = textFrame.anchoredObjectSettings.verticalReferencePoint;
              
              // To add a new text frame and to thread it to the anchored one, 
              // we first have to un-anchor (release) the selected text frame:
              textFrame.anchoredObjectSettings.releaseAnchoredObject();
              
              // We need a new text frame to thread the released one with.
              // I chose to add a duplicate of the released text frame out of simplicity.
              // In CS6 and above this is positioned on top of the released one. 
              // The duplicate is selected now and cached in a variable:
              var dup = textFrame.duplicate();
              // Set the contents of the duplicate to an empty string, it is empty now.
              dup.parentStory.contents = "";
              // Thread the duplicate to the released text frame:
              textFrame.nextTextFrame = dup;
              
              // Re-anchor the released text frame to the insertion point of the main story I cached with a variable before:
              textFrame.anchoredObjectSettings.insertAnchoredObject(insertionPoint , AnchorPosition.ANCHORED);
              // Apply the cached settings for anchoring the text frame you have selected in step one:
              textFrame.anchoredObjectSettings.properties =
              {
                  anchorPoint : anchorPoint,
                  anchorXoffset : anchorXoffset,
                  anchorYoffset : anchorYoffset,
                  anchoredPosition : anchoredPosition,
                  horizontalAlignment : horizontalAlignment,
                  horizontalReferencePoint : horizontalReferencePoint,
                  pinPosition : pinPosition,
                  spineRelative : spineRelative,
                  verticalAlignment : verticalAlignment,
                  verticalReferencePoint : verticalReferencePoint
              };
          
              // That's it.
              // Now you have only to move the selected and threaded new text frame to the next page.
              // And perhaps lower the height of the anchored one to flow text to the next page.
          
          };
          

           

          You can undo the whole operation in one go after running the script.

           

          Have fun,

          Uwe

          • 2. Re: how can I make the anchor object to span over two faced or sequencial pages if these anchor objects are texts?
            Laubender Adobe Community Professional & MVP

            Forgot to add a screenshot that shows the situation after running the script and moving the threaded text frame to the next page:

             

            AfterRunningScript-And-MovingTextFrame-To-NextPage.png

             

            Also read my comments in the source code of the script to understand how this script is working.

             

            Uwe

            • 3. Re: how can I make the anchor object to span over two faced or sequencial pages if these anchor objects are texts?
              Obi-wan Kenobi Adobe Community Professional

              Hi Uwe,

               

              I've not tested your script yet but I've a question: if the layout moves, what happens?

              Can you confirm me that we can get the X-offset of the first line of a para with Javascript?

               

              Thanks! 

              • 4. Re: how can I make the anchor object to span over two faced or sequencial pages if these anchor objects are texts?
                Laubender Adobe Community Professional & MVP

                Hi Obi-wan,

                with an EventListener one could do a lot more for automating this.
                And yes, the x-offset could be readout. Also other coordinates of the anchor.

                 

                To do it in every case, even when the text frame holding the anchor is rotated or sheared or flipped is a different thing.
                It could be done, but requires some processing.

                Then the question would be, how would processing time interfer with redrawing and adjusting the anchored object and the text frame that is threaded to it…

                 

                Uwe

                • 5. Re: how can I make the anchor object to span over two faced or sequencial pages if these anchor objects are texts?
                  Obi-wan Kenobi Adobe Community Professional

                  Uwe,

                   

                  That's why maybe there's a fluider way:

                  2 stories on the page. The op copies and pastes all the paras he wants in the "side" story (maybe the script can do it!).

                  He places an invisible marker as # at the beginning of all the paras he wants to be treated (maybe by a simple grep research).

                  The script will simply search all the #: when it finds the first in the story A, it keeps its X-Offset and applies it to the first # in the story B … and so on!

                   

                  Doable?

                   

                  [ Don't forget: I'm not a scripter!  ]

                  • 6. Re: how can I make the anchor object to span over two faced or sequencial pages if these anchor objects are texts?
                    Laubender Adobe Community Professional & MVP

                    Yes, I think so.
                    Practical problems would only arise, if that kind of script is actually written and tested ;-)

                     

                    Uwe

                    • 7. Re: how can I make the anchor object to span over two faced or sequencial pages if these anchor objects are texts?
                      Obi-wan Kenobi Adobe Community Professional

                      Aha! If you write such a script, many will take it and do not even tell you thank you! 

                      • 8. Re: how can I make the anchor object to span over two faced or sequencial pages if these anchor objects are texts?
                        emi_233 Level 1

                        I still understand it and try it, Off course will thank him and maybe will ask if I face a problem in this script.