5 Replies Latest reply on Jul 27, 2013 11:50 PM by tzufloigen

    Can't get text paths if there are groups

    tzufloigen

                tell myDocument

                          set myPitems to (every text path of every page item of every page) whose contents = ""

                          repeat with Pitem in myPitems

        display dialog "got it"

                                    delete Pitem's parent

                  end repeat

                end tell


      This is a working script - as long as there is nothing grouped in the document. (Took a while to figure out why it was throwing an error!) None of the text paths I need are grouped, incidentally.

       

      I am deleting all objects that have "text on a path" set up but no text on them.

       

      What am I doing wrong? Do I need to ungroup everything first? Is there an easy way to temporarily ungroup everything?

       

      Thank you!

        • 1. Re: Can't get text paths if there are groups
          tzufloigen Level 1

          I decided to just ungroup everything, but for anyone reading this later, this doesn't really work - it deletes the second item of linked text paths, but doesn't consider the contents of the first text path as "".

          • 2. Re: Can't get text paths if there are groups
            tzufloigen Level 1

            This is pretty sad... I'm at this for hours and can't figure it out, I post here and voila progress!

             

            For anyone else with this issue, you may need to first remove all <FEFF> characters.

             

            Still don't know how to regroup my groups, though.

            • 3. Re: Can't get text paths if there are groups
              ScreenNamesUnavailable

              G'day

               

              i couldn't get

              set myPitems to (every text path of every page item of every page) whose contents = ""

              to work in CS5

               

              But if none of your text paths are in groups, you can just bypass the page items that are groups :

                        tell myDocument

                                  set myPitems to every page item whose class is not group

                                  repeat with x in myPitems

                                            try

                                                      set myEmptyPath to ((text path 1 of x) whose contents = "")

                delete parent of myEmptyPath

                                            end try

                                  end repeat

                        end tell

               

              Hope that helps

               

              m.


              • 4. Re: Can't get text paths if there are groups
                ScreenNamesUnavailable Level 1

                Alternatively .....

                 

                if you need to drill into the groups you can do it like this :

                 

                                    set myGroups to every page item whose class is group

                                    repeat with y in myGroups

                                              set myPitems to page items of y

                                              repeat with x in myPitems

                                                        try

                                                                  set myEmptyPath to ((text path 1 of x) whose contents = "")

                  delete parent of myEmptyPath

                                                        end try

                                              end repeat

                                    end repeat

                 

                but that will only get you down one level (ie. not helpful if you have grouped groups, etc.)

                 

                m.


                • 5. Re: Can't get text paths if there are groups
                  tzufloigen Level 1

                  Thank you so much!

                   

                  I have now had time to test completely, and this does solve my issues, saving me untold amounts of time. Many, many thanks!