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

SCRIPT INDESIGN CC 2019 MAC / Select all Anchor Object in document

New Here ,
Dec 05, 2018 Dec 05, 2018

Copy link to clipboard

Copied

Hi all

Looking for a script that lets me select all ANCHORS images in my document or....all images or

Select all images and tag them as IMAGES ( in my tag panel : IMAGES, STORY, ARTIFACT )

Can someone help me out

TOPICS
Scripting

Views

1.1K

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
Contributor ,
Dec 05, 2018 Dec 05, 2018

Copy link to clipboard

Copied

hi sean,

     you can find all images in this way, If you know manually you can create script for this also.

Capture.PNG

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 ,
Dec 06, 2018 Dec 06, 2018

Copy link to clipboard

Copied

Hi seanf33852861 ,

you can only select one anchored object at one time with InDesign.

Scripting with method select() makes no difference.

What you are able to do: You can address all anchored images in your document.

That means you can store the reference to all anchored images and do something with them after identifying the ones.

What do you like to do with all anchored images?

EDIT: Oh. You already answered that. You want to tag them as IMAGES.

Here some code to filter all anchored graphics:

// All graphics of the document stored to variable allGraphicsOfDoc:

var allGraphicsOfDoc = app.documents[0].allGraphics;

// Now that we stored all graphics of the document in an array we can sort out the ones that are anchored.

// Would you need all graphics, that means also placed PDFs, AIs, EPS, WMFs? Or only pixel based ones?

// Preparing a container, an array for the results:

var allAnchoredGraphics = [];

// Looping the allGraphicsOfDoc array to filter the ones we need:

for( var n=0 ; n<allGraphicsOfDoc.length ; n++ )

{

    // The parent of a graphic is always a graphic frame

    // If the parent of that graphic frame is a character, the graphic frame containing the graphic is anchored:

    if( allGraphicsOfDoc.parent.parent.constructor.name == "Character" )

    {

        allAnchoredGraphics[allAnchoredGraphics.length++] = allGraphicsOfDoc;

    }

};

// Looping the result to do something to the filtered graphics:

for( var n=0; n<allAnchoredGraphics.length; n++)

{

    doSomethingWithGraphic( allAnchoredGraphics );

}

// Change this function to your needs:

function doSomethingWithGraphic( graphic )

{

    // Get the name of the item link of the placed graphic

    try{

    $.writeln( graphic.itemLink.name );

    }catch(e){ $.writeln( e.message ) };

};

One could also use a GREP find routine for anchored objects.

But you may have also anchored objects like text frames, rectangles or other graphic frames without a graphic in your document.

The allGraphics array may be more to the point.

FWIW: Graphics in graphic cells of a table do not fall under the category "anchored" with the code above.

If you want to include them we have to change the if condition.

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
New Here ,
Jun 26, 2019 Jun 26, 2019

Copy link to clipboard

Copied

Sorry for the late late reply:P

I tried your Script in my Script editor on my mac getting this error msg.

thank you

Can you MSG me privatly too..so I know il get the answer quicklyScreen Shot 2019-06-26 at 3.43.08 PM.png

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 26, 2019 Jun 26, 2019

Copy link to clipboard

Copied

It's JavaScript, not AppleScript. Copy into the ExtendScript Toolkit Editor instead, and save with a .jsx extension to make it work.

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 27, 2019 Jun 27, 2019

Copy link to clipboard

Copied

LATEST

A detailed description on how to use the script(jsx) someone shared on the forum, is given in the link below

https://indesignsecrets.com/how-to-install-a-script-in-indesign-that-you-found-in-a-forum-or-blog-po...

-Manan

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 ,
Dec 06, 2018 Dec 06, 2018

Copy link to clipboard

Copied

Should a placed AI graphic be tagged as IMAGE as well?

Or only pixel based images like PSDs, JPEGs, TIFFs ?

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
New Here ,
Dec 06, 2018 Dec 06, 2018

Copy link to clipboard

Copied

Awsome!

If I can select all Images Anchor in all the document that would be awsome!...

reason : its for accessibility, I have a document that has 800 links, all anchors and they are all in a TABLE.

So if I can select all the boxes in my document, this will reduce my time of all selecting them as IMAGES, cause the other select as STORY is less time then images, hope I am amking sense....

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 ,
Dec 08, 2018 Dec 08, 2018

Copy link to clipboard

Copied

seanf33852861  wrote

Awsome!

If I can select all Images Anchor in all the document that would be awsome!...

…

As I already said:

You cannot select more than one anchored object at one time.

Are the said 800 linked images anchored in text cells of the table?
Or are they inserted in graphic cells?

To access all graphics of a table you need the table and the allGraphics array of the table.

You would then loop the array and then tag every entry as you wish by using scripting.

You could try the autoTag() method if you like to apply the XML tag named "Image".

In my German InDesign the auto name for that XML tag will be "Bild".

One warning with that method:
In case the anchored graphic is in overset you will freeze InDesign.

Just tested that with InDesign CC 2019.

If you are talking not of XML tags, show how you are tagging a single anchored image using some screenshots.

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