4 Replies Latest reply on May 18, 2010 1:14 PM by Kathlene Ruhan

    Change tools (mid-command) in applescript

    Kathlene Ruhan Level 3

      I have a question similar posed but am in hopes this may bring more to thought -

       

      I have a grouped item on page 1 of 4 pages. (InDesign, CS3 MAC OSX 10.5.3). I can select the text header via the script, but can I change from the find/change commands (text tool) to a selection (tool) straight away to grab the entire group? It needs to be removed from the page.

        • 1. Re: Change tools (mid-command) in applescript
          [Jongware] Most Valuable Participant

          InDesign scripts don't really use the tools at all. As soon as you have a "handle" onto a text frame, for example, you can:

           

          1. address its formatted text, through use of "handle.texts" or "handle.paragraphs[x]" or "handle.characters[y]", or its unformatted text through "handle.contents"

           

          2. address the frame itself, such as "handle.strokeWeight", "handle.fillColor"

           

          3. address its ancestors: "handle.parent" (and "handle.parent.parent", and so on, ad nauseum).

           

          It's perfectly valid to do a "handle.parent.remove()" (although after that, the handle is no a longer valid object -- makes sense don't it).

           

          In your case, are you using the find/change immediately onto the contents of one of the group items? If so, the immediate parent of the text object (unto which you bestowed your changes) is its containing text frame, and if you are fairly certain that's always part of a larger group, its parent in turn is the group object.

          • 2. Re: Change tools (mid-command) in applescript
            [Jongware] Most Valuable Participant

            (Wait -- it sounds like first you are doing a replace operation on text in a frame, and then you want to remove the group containing that frame?)

            • 3. Re: Change tools (mid-command) in applescript
              Kathlene Ruhan Level 3

              Yup - I was using the find/change so I could select something in the group, and then somehow delete the group in its entirety. It is a long shot for me but, I'm not sure how to do it otherwise.

              • 4. Re: Change tools (mid-command) in applescript
                Kathlene Ruhan Level 3

                This answer is half tasked - I found that one would have to script to ungroup the text boxes and then delete the them. One hangup is that there is a header to be deleted, and I need to isolate that (there are three identical boxes) and delete it.