Script to create a text layer

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: xbytor, Kukurykus, Tom

raaaatata
Posts: 1
Joined: Tue Sep 24, 2019 6:35 am

Script to create a text layer

Post by raaaatata »

Hi, help me write a script to create a text layer, where text = name of the active layer

User avatar
txuku
Posts: 103
Joined: Thu Jan 01, 1970 12:00 am

Re: Script to create a text layer

Post by txuku »

Bonjour

Not yet awake ..........
I come across your old post

Not sure if I understood everything here is a script

Code: Select all

/CalcTextName.jsx

var doc = app.activeDocument;
var nameDoc = doc.name;
var nameLayer = nameDoc ;

doc.activeLayer.name = nameLayer;
//alert( doc.activeLayer.kind.contents );
// if there is more than one layer, do your script
if (doc.layers.length > 1) 
{
   for(i=0; i < doc.layers.length; i++)
  { 
      
      doc.activeLayer = doc.layers[i];
      //alert(i);
      //alert(doc.activeLayer.kind ) //typename
      if(doc.activeLayer.kind=="LayerKind.TEXT") 
      {
        //doc.activeLayer.remove();
        doc.activeLayername = nameLayer;
        alert(nameLayer);
      }
   }    
 }
Good luck !