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

Help!!!! to Merge infinite layers to single layer

Guest
Dec 04, 2012 Dec 04, 2012

Copy link to clipboard

Copied

Hi everybody,

i have this script for merging layers "only 2 layers will be merged... adding layer A & layer B", which is also found in indesign scripting guide.

I am trying to merge the infinity layers inside document to single layer.

can any one tweak this script, as per my request.

main();

function main(){

          mySetup();

          mySnippet();

          myTeardown();

}

function mySetup(){

          var myDocument = app.documents.add();

          myDocument.layers.add();

}

function mySnippet(){

    var myDocument = app.documents.item(0);

          //<fragment>

          //Given a document "myDocument" containing at least two layers...

          var myLayerA = myDocument.layers.item(0);

          var myLayerB = myDocument.layers.item(1);

          myLayerA.merge(myLayerB);

          //</fragment>

I tweaked like this.... script runs without error but no result,,, leaving the layers unmerged...

main();

function main(){

          mySetup();

          mySnippet();

          myTeardown();

}

function mySetup(){

          var myDocument = app.documents.add();

}

function mySnippet(){

    var myDocument = app.documents.item(0);

          //Given a document "myDocument" containing infinity layers...

          var myLayers = myDocument.activeLayer.everyItem();

          myLayers.merge;

}

function myTeardown(){

}

thanks

babylon.

TOPICS
Scripting

Views

680

Translate

Translate

Report

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

Deleted User
Dec 05, 2012 Dec 05, 2012

ya super fantastic vamit...

thanks buddy.

Votes

Translate

Translate
Advisor ,
Dec 05, 2012 Dec 05, 2012

Copy link to clipboard

Copied

try:

function main(){

var doc=app.activeDocument;

var lrs=doc.layers.everyItem().getElements(), l=lrs.length;

while (l--){

    lrs[0].merge(lrs);

    }

alert('Done!\nYou can go outside an play now!');

}main();

Votes

Translate

Translate

Report

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
Guest
Dec 05, 2012 Dec 05, 2012

Copy link to clipboard

Copied

LATEST

ya super fantastic vamit...

thanks buddy.

Votes

Translate

Translate

Report

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