Skip to main content
Participating Frequently
November 7, 2016
Answered

Is there a way to automate changing all graphic frames to unassigned frames…

  • November 7, 2016
  • 3 replies
  • 1186 views

A number of our clients supply Word files with graphics embedded, often with too low a resolution or placed with distorted dimensions. It would be helpful to retain placeholders in the layout without keeping the actual unusable graphics (don't want to leave them in and use them by mistake).

Is there a way to automate changing all graphic frames to unassigned frames, preferably being able to set a fill/stroke to identifiy them as placeholders?

This topic has been closed for replies.
Correct answer Jump_Over

Hi,

So test this code:

#target indesign

var

    mDoc = app.activeDocument,

    mGraphics = mDoc.allGraphics,

    mNone = mDoc.swatches[0],

    mStroke = mDoc.swatches.itemByName(""),

    mFill = mDoc.swatches.itemByName(""),

    cGraphic;

   

while (cGraphic = mGraphics.pop()){

    cGraphic.parent.strokeColor = mStroke.isValid ? mStroke : mNone;

    cGraphic.parent.fillColor = mFill.isValid  ? mFill : mNone;

    cGraphic.remove();

    }

Warning:

All doc's graphics will be removed!

Tip:

Paste a color name from Panel Swatches (line #5 & #6) if your goal is to change Stroke/Fill

Leave them empty ("") if your goal is not to change

Jarek

3 replies

Community Expert
November 7, 2016

Roy - GCG wrote:

A number of our clients supply Word files with graphics embedded, often with too low a resolution or placed with distorted dimensions.

Hi Roy,

speaking about distorted dimensions:


The reason is, that InDesign is ignoring cropping values of images during Word import.

It changes the dimesions of the images to fit the frame's boundaries.

Regards,
Uwe

Roy - GCGAuthor
Participating Frequently
November 7, 2016

Hi Laubender,

Unfortunately, that is not the case. We get a lot of "new" authors and they simply resize the photos to fit their esthetic with no concern about how abnormal the photo contents look as long as it fits on the page they want. They look just as distorted in Word as they do after importing to InDesign.

BobLevine
Community Expert
Community Expert
November 7, 2016

When you place the Word document, the graphics will appear in the links panel with names like graphic1111.png. Just drag the new graphic, from finder, Windows Explorer or Bridge right on top of the one you want to replace. When you’re done just go through the links names.

BTW, if you can train them to use proper, high quality graphics, you’re job will already be done. Those images will maintain their original quality.

Roy - GCGAuthor
Participating Frequently
November 7, 2016

BobLevine wrote:

When you place the Word document, the graphics will appear in the links panel with names like graphic1111.png. Just drag the new graphic, from finder, Windows Explorer or Bridge right on top of the one you want to replace. When you’re done just go through the links names.

BTW, if you can train them to use proper, high quality graphics, you’re job will already be done. Those images will maintain their original quality.

Hi Bob,

Thanks for the tip. My problem is that the department head want's "grey boxes" where the bad photos were and after my first round of formatting, she will decide where best to relocate the pictures, after we rescan at a higher quality. She actually wants me to import the text without the graphics then add in the grey boxes where the graphics were in the manuscript. I just figured converting the graphic frames to unassigned and shading them would be a lot faster if there were a script to do that.

re: Training, that's always what I'd prefer, but we get a lot of word of mouth referrals, so a lot of untrained authors with their already completed Word docs knock at our door. Hopefully by their second or third book, we'll have improved their techniques, but the bulk will always be a bit of a mess with bad scans, space runs, paragraph returns instead of page breaks, paragraph returns at the end of each line like it was a typewriter (and boy do I hope they did double paragraph returns between actual paragraphs), etc.. You know, the usual.

Jump_Over
Jump_OverCorrect answer
Legend
November 7, 2016

Hi,

So test this code:

#target indesign

var

    mDoc = app.activeDocument,

    mGraphics = mDoc.allGraphics,

    mNone = mDoc.swatches[0],

    mStroke = mDoc.swatches.itemByName(""),

    mFill = mDoc.swatches.itemByName(""),

    cGraphic;

   

while (cGraphic = mGraphics.pop()){

    cGraphic.parent.strokeColor = mStroke.isValid ? mStroke : mNone;

    cGraphic.parent.fillColor = mFill.isValid  ? mFill : mNone;

    cGraphic.remove();

    }

Warning:

All doc's graphics will be removed!

Tip:

Paste a color name from Panel Swatches (line #5 & #6) if your goal is to change Stroke/Fill

Leave them empty ("") if your goal is not to change

Jarek

John T Smith
Community Expert
Community Expert
November 7, 2016

Please post the name of the program you use so a Moderator may move this message to the correct program forum

This forum is not about help with programs... a program would be Photoshop or Dreamweaver or Muse or ???

Roy - GCGAuthor
Participating Frequently
November 7, 2016

Sorry, I'd started in the InDesign forum and hadn't realized I'd been dumped into a general forum. I'm using InDesign CC 2014 through 2017 on Mac OS 10.11.6

Peter Spier
Community Expert
Community Expert
November 7, 2016

Moved to InDesign Scripting....