Search code examples
layeradobe-illustratorinvisible

How do I make an Illustrator script that makes a specific layer invisible?


I have no experience in programming, so I apologize for being new to everything.

I am trying to make a simple Illustrator script that a specifically named layer (for example, "text") in all open files invisible. It would also be nice if it could save all the files in the end.

simple example simple example

If anyone can help, that would be great.


Solution

  • This is script to invisible layer name ="text" and save after edit:

    for(var i=0;i<app.documents.length;i++)
    {
            var oDoc=app.documents[i];
            for(var j=0;j<oDoc.layers.length; j++)
            {
                if(oDoc.layers[j].name=="text")
                {
                    oDoc.layers[j].visible=false;
                 }
           }
          oDoc.save();
    }