Her

Home Photoshop Tutorials Miscellaneous New Art Layer

New Art Layer

Author: FotoFects Author's URL: http://www.fotofects.com More by this author

New Art LayerIf you are new to scripting for Photoshop, please view our Photoshop Scripting Basics tutorial for an introduction to Photoshop scripting and a few exercises about basic JavaScript.

1. Check for an opened document so that this script will only run if there is an opened document.

if (documents.length > 0) {

}


2. Type in add(); to tell the script we want to add something.

if (documents.length > 0) {
add();
}


3. Now we can tell the script that we want to add a layer. Type in artLayers followed by a period.

if (documents.length > 0) {
artLayers.add();
}


4. Finally, we need to tell the script which opened document to add the layer to. Type in activeDocument followed by a period.

if (documents.length > 0) {
activeDocument.artLayers.add();
}


5. We can also create a name for the layer. Type in .name = followed by the title. Because the title is a string, don't forget to add quotations around it.

if (documents.length > 0) {
activeDocument.artLayers.add().name = "My Photoshop Layer";
}

Save the script and run it inside Photoshop (File> Scripts> Browse). If the script does nothing, it means that you don't have any documents opened for it to create a new layer for.