5 Replies Latest reply on Jun 20, 2017 8:31 AM by jays55219621

    Find inline images and apply paragraph style

    jays55219621 Level 1

      First: I don't want anyone to write me a script -- just point me in the right direction.

      I have dozens of files filled with lists in which the designer inserted these hideous eps triangles they, apparently, thought were more attractive than a traditional bullet.

      I have a script to delete the graphics and frames but before I use it, I'd like to find every paragraph (hundreds) with one of these graphics at the beginning and apply a paragraph style. I know how to something at the beginning and change the style ... how do I identify an anchored object?

      I've found plenty of scripts that convert text in an anchored object to inline text but these are graphics. They're all the same eps so that might help, right?

        • 1. Re: Find inline images and apply paragraph style
          uniqued_tol Level 1

          Hi jays; Find grep: ^~a\h*(.)

          change:$1

          Change format:autobulletPstyle (paragraph style)

          • 3. Re: Find inline images and apply paragraph style
            Laubender Adobe Community Professional & MVP

            Hi,

            I would do it a bit more granular looping the allGraphics array of your document.

             

            var allGraphicsInDoc = app.activeDocument.allGraphics;
            

             

            Loop all entries in this array and check if the parent of the parent of an entry is a character.

            That would be the most important check. If not you could loop on with a simple continue .
            If it is a character, you found the anchor character and that gives you access to the paragraph where the graphic is anchored.

             

            Also do some other checks while looping:

            The next I would suggest: Is the graphic positioned at the very beginning of the paragraph? You basically ask:

            Is the index value of the anchor character the same as the index value of the first character in the paragraph of the anchor character?

             

            Perhaps also check, if itemLink of the graphic is undefined. We need itemLink to identify an EPS as EPS leaving e.g. a JPEG alone.

            If itemLink is undefined loop on with continue, because we are not interested in pasted pixels. We are interested in graphics that have links, embedded or not ( my assumption ). Ask for itemLink.linkType that could return a string like "EPS".

             

            Is the applied paragraph style of the anchor character the expected one?

            You could ask this, if you want to remove anchored graphics only, if a certain paragraph style is applied to the text.

             

            A trick is:

            Select one of the graphics and store all sigificant values of the selection to variables.

            What is significant? You decide, you know the document.

             

            While looping you can ask, if the values of the selected graphic are identical with the one of the graphic you currently loop.

            If not continue the loop without doing anything with statement continue.

             

            Make sure that all graphics you want to remove really share the same significant values.

            Same name? Do a check of itemLink.name . Otherwise don't use that check.

             

            Hope, that gets you started.

             

            Regards,

            Uwe

            • 4. Re: Find inline images and apply paragraph style
              jays55219621 Level 1

              I've seen that solution (putting $1 in the change field) elsewhere but whenever I try that, it replaces whatever I'm finding ("^\d\." -- without the quotes -- for example) with "$1". Otherwise, this solution would be perfect. I just can't get it to work like you and everyone else say it should.

              • 5. Re: Find inline images and apply paragraph style
                jays55219621 Level 1

                Eventually, I found a script similar to what I needed that used itemLink.name -- one of the missing pieces I needed -- and that helped me to write one of two scripts I ended up using that I'll post later when I'm at home.