Apply blending mode to images in group with a script
I have a long document with many photos. These photos are in groups along with their captions. They currently have the blending mode "Luminosity" applied, but I want them to have "Normal" applied.
I found this script which does exactly what I want with a little modification. But it only works on regular rectangles. If I put the rectangle in a group, the script no longer works on it. Therefore the script doesn't work for my documents because they all have images within groups. How do I modify the script to look within groups?
Here's what I have so far:
// the main function
var main = function() {
var doc = app.activeDocument; // get the current document
// loop the pages
for (var i = 0; i < doc.pages.length; i++) {
var page = doc.pages[i]; // isolate the page
// loop all rectangles
for(var j = 0; j < page.rectangles.length;j++){
var rect = page.rectangles[j]; // isolate a rectangle
// test if there is an image inside
if(rect.images.length > 0){
var image = rect.images[0]; // isolate the image
// asign a random color from th swatches
image.transparencySettings.blendingSettings.blendMode = BlendMode.NORMAL;
} // end if image
} // end loop j rectangles
} // end loop i pages
} // end of main
main(); // run itThanks in advance!
