Clipping Paths in whol Document
Learn / Forums / InDesign Add-ons (Scripts, Scripting, and Plug-ins) / Clipping Paths in whol Document
- This topic has 1 reply, 1 voice, and was last updated 6 years, 7 months ago by Tom Tramita.
-
AuthorPosts
-
-
September 15, 2017 at 12:14 pm #98122Tom TramitaMember
Hey, Guys,
Im really sorry if this is solved topic already, but could someone help me with functionality of this script? It looks like it works fine but it shows that no clipping path is avaible, even when there are clipping paths with the same name in every picture of the document.
Script:
main();
function main(){var
i, j, allGraphics,
allGraphicsArrays = app.activeDocument.pages.everyItem().allGraphics;for (var i=0; i<allGraphicsArrays.length; i++) {
var myObject = allGraphicsArrays[i];
for (j=0; j<myObject.length; j++) {
try{myObject.pageItems.item(0).clippingPath.appliedPathName = myObject.pageItems.item(0).clippingPath.photoshopPathNames[0];
myObject.pageItems.item(0).clippingPath.clippingType = ClippingPathType.PHOTOSHOP_PATH;}
catch (myError) {
// If it can’t apply the Photoshop path then it obviously does not have one
alert(“Selected image does not have a Photoshop path applied”)
}
}
}
} -
September 15, 2017 at 2:30 pm #98139Tom TramitaMember
I found it out!
I think the “pageItems.item was not defined totaly, so here is the working one!Script:
main();
function main(){var i, j, allGraphics,
allGraphicsArrays = app.activeDocument.pages.everyItem().allGraphics;for (var i=0; i<allGraphicsArrays.length; i++) {
var myObject = allGraphicsArrays[i];
for (var j=0; j<myObject.length; j++) {
try{myObject[j].clippingPath.appliedPathName = myObject[j].clippingPath.photoshopPathNames[0];
myObject[j].clippingPath.clippingType = ClippingPathType.PHOTOSHOP_PATH;}
catch (myError) {
alert(“Selected image does not have a Photoshop path applied”)
}
}}
}
-
-
AuthorPosts
- You must be logged in to reply to this topic.