Copy link to clipboard
Copied
Hey. I'm loosing it here. Trying to setup a loop through a layer to rasterize each pathItem as well only raster the ones visible, which I haven't gotten to yet. I can't seem to get it to give me just the path items though. Maybe my syntax is wrong. Help is much appreciated.
function rasterLayers() {
var myLayer = idoc.layers["My Special Layer"];
for(var a=0;a<myLayer.layers.length;a++){
var currentItem = myLayer.layers.pageItems;
currentItem.selected = true;
idoc.rasterize( currentItem ,currentItem.visibleBounds, newoptions);
}}
rasterLayers();
function rasterLayers() {
var myLayer = idoc.layers["My Special Layer"];
for(var a=0;a<myLayer.layers.length;a++){
var currentItem = myLayer.layers.pageItems; // myLayer.layers[ ??? ] - not id
currentItem.selected = true;
idoc.rasterize( currentItem ,currentItem.visibleBounds, newoptions);
}
}
rasterLayers();
As an option:
...function rasterLayers() {
var myLayer = activeDocument.layers["My Special Layer"];
for ( var a = 0; a < myLayer.layers.length; a++ ) {
Copy link to clipboard
Copied
function rasterLayers() {
var myLayer = idoc.layers["My Special Layer"];
for(var a=0;a<myLayer.layers.length;a++){
var currentItem = myLayer.layers.pageItems; // myLayer.layers[ ??? ] - not id
currentItem.selected = true;
idoc.rasterize( currentItem ,currentItem.visibleBounds, newoptions);
}
}
rasterLayers();
As an option:
function rasterLayers() {
var myLayer = activeDocument.layers["My Special Layer"];
for ( var a = 0; a < myLayer.layers.length; a++ ) {
for ( var b = 0; b < myLayer.layers.pageItems.length; b++ ) {
var currentItem = myLayer.layers.pageItems;
currentItem.selected = true;
activeDocument.rasterize( currentItem, currentItem.visibleBounds );
}
}
}
rasterLayers();
Copy link to clipboard
Copied
Good looken out A. Looping through both the layer and sublayer I didn't think about. The one you put up works but gives an error if any of the layers are turned off. I will attempt to write statement for this to stop if layers are off. But I can't guarantee I won't be posting for more help since I am a JS novice (:
Find more inspiration, events, and resources on the new Adobe Community
Explore Now