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

Script that adds a layer of text with the name of the selected layer to the document

Contributor ,
Jun 07, 2017 Jun 07, 2017

Copy link to clipboard

Copied

Hi friends! I'm looking for a script that adds to the document a layer of text written with the same characters as the selected layer.

Example:

1-Document with a layer named "Picture_3: Print" selected.

2-run Script:

3 - Add in the document a layer of text written "Picture_3: Print"

Thanks in advance:

Screenshot_1.jpg

TOPICS
Actions and scripting

Views

3.6K

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
Adobe
Community Expert ,
Jun 07, 2017 Jun 07, 2017

Copy link to clipboard

Copied

It look like you actually want a lot more than you wrote to me.  I think you want the text to be some size, be some font, aligned to something, and fit. None of which you mentioned.

JJMack

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
Community Expert ,
Jun 07, 2017 Jun 07, 2017

Copy link to clipboard

Copied

Good points.

What are the exact rules that should determine the position and orientation of the Type Layer?

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
Contributor ,
Jun 08, 2017 Jun 08, 2017

Copy link to clipboard

Copied

As for position and orientation, you can add at the top, left, then I will edit the positions for each document.

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
Community Expert ,
Jun 08, 2017 Jun 08, 2017

Copy link to clipboard

Copied

Top left now we need to know text size relative to document size and resolution. To know where the bottom left of the text will be relative to the document top left  0,0 X Y point, then there is font.

Why do  you want a layer name as a text layer.  What are you actually trying to do?

JJMack

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
Contributor ,
Jun 08, 2017 Jun 08, 2017

Copy link to clipboard

Copied

Hi c.pfaffenbichler

The size of A4 Document (21x29.7 cm) with resolution 250 pixels / inch

Source: Arial

Size: 12pt

Black color

Hi JJMack

Why do you want a layer name as a text layer. What do you really want to do?

This was the basis for the identification of the product type to stamp on shirts, cups and other ....

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
Community Expert ,
Jun 08, 2017 Jun 08, 2017

Copy link to clipboard

Copied

Is the document a single layer document  multi layered document if it a layered document do you want text layer for each layer or for particular layer types or a particular layers if more the on text layer is to be added should all positions top left.

When you want to automate something in Photoshop you need design the process well..   You are not going to find a script on the web to does exactly what you seem to want to do.  You will need to write your own custom script.

Adobe Photoshop Scripting | Adobe Developer Connection

JJMack

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
Contributor ,
Jun 08, 2017 Jun 08, 2017

Copy link to clipboard

Copied

This JJMack is a figure! He asks a series of technical questions and does not end the user to become alone ... I was once dismissed in the same way.

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
Contributor ,
Jun 08, 2017 Jun 08, 2017

Copy link to clipboard

Copied

Hi Ps-Design! this script is a bit like what you need, I believe there is a user exeto the JJMack that I can make a change in some lines of this script to meet your needs. Hope this helps, good luck.

The script will prompt for a text file containing the names.

  1. #target photoshop; 
  2. if(documents.length) main(); 
  3. function main(){ 
  4. var txtFile = File.openDialog("Please select TEXT.","TXT File:*.txt"); 
  5. var Names = []; 
  6. if(txtFile == null) return
  7. txtFile.open('r'); 
  8. var data = txtFile.read(); 
  9. txtFile.close(); 
  10. data = data.split('\n'); 
  11. for (var a in data){ 
  12.     var line = data.replace(/^\s+|\s+$/g); 
  13.     if(line.length >3) Names.push(line); 
  14.     } 
  15. for(var n in Names){ 
  16.     createTextLayer(Names); 
  17.     } 
  18. }; 
  19. function createTextLayer(layerName) {   
  20. var startRulerUnits = app.preferences.rulerUnits; 
  21. app.preferences.rulerUnits = Units.PIXELS; 
  22. var thisLayer = activeDocument.artLayers.add();  
  23. thisLayer.kind = LayerKind.TEXT;  
  24. thisLayer.name = layerName;  
  25. var textProperty = thisLayer.textItem;  
  26. textProperty.kind = TextType.POINTTEXT; 
  27. //Font Size 
  28. textProperty.size = 10;  
  29. textProperty.font = "Arial";  
  30. var newColor = new SolidColor();  
  31. //Font Colour 
  32. newColor.rgb.red = 0;  
  33. newColor.rgb.green = 0;  
  34. newColor.rgb.blue = 0;  
  35. textProperty.color = newColor;  
  36. textProperty.position = new Array( 100,100); 
  37. thisLayer.blendMode = BlendMode.NORMAL;  
  38. thisLayer.opacity = 100;  
  39. textProperty.contents = layerName;  
  40. app.preferences.rulerUnits=startRulerUnits; 
  41. };

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
Community Expert ,
Jun 08, 2017 Jun 08, 2017

Copy link to clipboard

Copied

That script does add a text layer but it not a script the does whet  the op wants.  They also did not state they knew anything about the scripting knowledge.  If the do not know anything about Photoshop scripting the will not be able to understand the code you posted and will not be able to modify it.

JJMack

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
Contributor ,
Jun 08, 2017 Jun 08, 2017

Copy link to clipboard

Copied

LATEST

Hello tokuredit thanks for the help! Great script, however it is critical that the added text layer contain the same characters as the last selected layer, without the need to use external .txt files.

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