• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Find inline images and apply paragraph style

Engaged ,
Jun 13, 2017 Jun 13, 2017

Copy link to clipboard

Copied

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?

TOPICS
Scripting

Views

1.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jun 13, 2017 Jun 13, 2017

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

...

Votes

Translate

Translate
Participant ,
Jun 13, 2017 Jun 13, 2017

Copy link to clipboard

Copied

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

change:$1

Change format:autobulletPstyle (paragraph style)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 13, 2017 Jun 13, 2017

Copy link to clipboard

Copied

This link may be useful https://forums.adobe.com/thread/2168501

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 20, 2017 Jun 20, 2017

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 13, 2017 Jun 13, 2017

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 20, 2017 Jun 20, 2017

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines