Skip to main content
December 19, 2012
質問

Reset multiple images' clipping paths to "None"

  • December 19, 2012
  • 返信数 2.
  • 5827 ビュー

In InDesign CS4, is there a way to check all images at once and reset their clipping paths to "none?" I work on catalogs that have several thousand photos (tif, Photoshop, and a few jpg files) in each one. We break the catalogs into approximately 10 sections/documents then organize them into a book file/palette, so there are only a few hundred images in each section/document. Originally a clipping path was applied to the photos (either a Photoshop clipping path or a "detect edges" path), but we now save them with transparency, so I'd like to be able to turn them all of at once (especially the "detect edges" paths).

Any suggestions? I know basically nothing about scripting, so writing a script wouldn't work in this case.

I appreciate any help...

Thanks,

Lloyd

このトピックへの返信は締め切られました。

返信数 2

Vamitul
Legend
December 20, 2012

here you go:

# target indesign

function main() {

          var docs = app.documents.everyItem().getElements(),

                    l = docs.length;

          while(l--) {

                    try {

                              docs.rectangles.everyItem().images.everyItem().clippingPath.clippingType = ClippingPathType.NONE;

                    } catch(e) {

                              alert(e);

                    }

                    alert('All done! You can go outside and play now!')

          }

}

app.doScript('main()', undefined, undefined, UndoModes.entireScript, 'Reset Clipping');

it works for all opened indesign files. I don't think it will work if you gave grouped pictures, buut i'm a bit short on time to tweak it now

Inspiring
December 20, 2012

Hi vamitul,

we've got a array here:

docs.rectangles.everyItem().images.everyItem().clippingPath

;-)

Vamitul
Legend
December 21, 2012

@Peter – not hard at all:

app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;

app.doScript(resetAllClippingPathsToActiveDoc, ScriptLanguage.JAVASCRIPT, [], UndoModes.ENTIRE_SCRIPT, "Reset all Clipping Paths of the Active Document");

function resetAllClippingPathsToActiveDoc(){

    var d=app.activeDocument;

    var allGraphicsInDoc = d.allGraphics;

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

        if(allGraphicsInDoc.hasOwnProperty("clippingPath")){allGraphicsInDoc.clippingPath.clippingType = ClippingPathType.NONE};

        };

};


Uwe


does it work? Still can't test.. 48%..

Peter Spier
Community Expert
Community Expert
December 19, 2012

I've moved this to the scripting forum. You may not know scripting, but these guys do, and I'm pretty sure one of them will help you out.