Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Raster pathItems in layer

Participant ,
Jun 17, 2016 Jun 17, 2016

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();

TOPICS
Scripting
586
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Participant , Jun 17, 2016 Jun 17, 2016

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++ ) {

       

...
Translate
Adobe
Participant ,
Jun 17, 2016 Jun 17, 2016

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();

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 17, 2016 Jun 17, 2016
LATEST

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 (: 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines