5 Replies Latest reply on Apr 27, 2018 9:58 AM by frameexpert

    Select textframe in framemaker.

    lathac41153227 Level 1

      How do I select all text frames in framemaker using extendscript ?

        • 1. Re: Select textframe in framemaker.
          frameexpert Level 4

          What is the overall thing you are trying to accomplish?

          • 2. Re: Select textframe in framemaker.
            lathac41153227 Level 1

            Hi ,

             

            I need to add and remove textframe in framemaker when page zoom and fit in page window process,and i want to move the textframe in page of the bottom in framemaker using extendscript.So please suggests if any ideas.

            • 3. Re: Select textframe in framemaker.
              frameexpert Level 4

              With ExtendScript, you don't really have to select a text frame to move it like you do in the interface. If you get the TextFrame object in a variable, you can change its LocX, LocY, Width, and Height properties to move it and resize it.

              • 4. Re: Select textframe in framemaker.
                frameexpert Level 4

                Here is how you can add a text frame to the current page:

                 

                #target framemaker
                
                // Get the active document object.
                var doc = app.ActiveDoc;
                
                // Define variables.
                var page, textFrame;
                
                // Get the current page.
                page = doc.CurrentPage;
                
                // Add a text frame to the page.
                textFrame = doc.NewTextFrame (page.PageFrame);
                // "Mark" the text frame so you can find it later.
                textFrame.Flow.Name = "zoom_frame";
                
                // Use the LocX, LocY, Width, and Height properties
                // to position and resize the text frame.
                // ...
                
                1 person found this helpful
                • 5. Re: Select textframe in framemaker.
                  frameexpert Level 4

                  Here is how you can find the text frame you added earlier and delete it:

                   

                  #target framemaker
                  
                  var doc = app.ActiveDoc;
                  
                  var page, textFrame;
                  
                  // Set a variable for the current page.
                  page = doc.CurrentPage;
                  // Try to find the text frame with the "zoom_frame" text flow.
                  textFrame = getTextFrame (page, "zoom_frame");
                  // If the text frame is found, delete it.
                  if (textFrame) {
                      textFrame.Delete ();
                  }
                  
                  function getTextFrame (page, flow) {
                      
                      // This function will find a text frame that 
                      // has a specified flow name on the page.
                      
                      var graphic;
                      
                      graphic = page.PageFrame.FirstGraphicInFrame;
                      while (graphic.ObjectValid () === 1) {
                          if (graphic.constructor.name === "TextFrame") {
                              if (graphic.Flow.Name === flow) {
                                  return graphic;
                              }
                          }
                          graphic = graphic.NextGraphicInFrame;
                      }
                  }
                  
                  1 person found this helpful