Skip to main content
Known Participant
September 13, 2019
解決済み

Copy Layer Name To Clipboard?

  • September 13, 2019
  • 返信数 2.
  • 5781 ビュー

Hey folks,

 

i am looking for a script, which allows me to copy the name of my active layer to the clipboard.

 

Thank you for your help and best regrads,

 

S.

このトピックへの返信は締め切られました。
解決に役立った回答 Stephen Marsh

The following code should do the trick, it does exactly what you ask and nothing else:

 

 

 

// Copy Active Layer Name to Clipboard.jsx
#target photoshop 
var doc = activeDocument;
var aLayer = doc.activeLayer.name;
var d = new ActionDescriptor();  
d.putString(stringIDToTypeID("textData"), aLayer);  
executeAction(stringIDToTypeID("textToClipboard"), d, DialogModes.NO); 

 

 

 

Based on:

https://community.adobe.com/t5/Photoshop/Copy-foreground-RGB-values-to-clipboard/td-p/10529244

 

返信数 2

Stephen Marsh
Community Expert
Stephen MarshCommunity Expert解決!
Community Expert
September 13, 2019

The following code should do the trick, it does exactly what you ask and nothing else:

 

 

 

// Copy Active Layer Name to Clipboard.jsx
#target photoshop 
var doc = activeDocument;
var aLayer = doc.activeLayer.name;
var d = new ActionDescriptor();  
d.putString(stringIDToTypeID("textData"), aLayer);  
executeAction(stringIDToTypeID("textToClipboard"), d, DialogModes.NO); 

 

 

 

Based on:

https://community.adobe.com/t5/Photoshop/Copy-foreground-RGB-values-to-clipboard/td-p/10529244

 

peterodzuck作成者
Known Participant
September 14, 2019

This script works awesome...

maybe you can help me out with my next problem. Now i want to rename my current group. The Name should be pasted from the clipboard.

 

thank you very much!

Stephen Marsh
Community Expert
Community Expert
September 16, 2019

your script is awesome! Thank you very much for your help! I do not want to be annoying, but can you show me the line where the "layer" is moved outside the group and if it´s possible to set the blendmode of the curvelayer to luminosity?

 

one more time. Thank you very very much!!!


The group was created independently, so the layer was not moved out of the group as the group was created empty. Do you require the original target/source layer to be inside the layer group/set (I was not sure from the original screenshot)?

 

To set the curve layer blend mode, the following two lines of code can be added after the curve code block, before the hue/saturation code block:

 

 

// Set the Curves Adjustment Layer to Luminosity Blend Mode
doc.activeLayer.blendMode = BlendMode.LUMINOSITY;

 

 

 

 

smithcgl9043167
Inspiring
September 13, 2019
////// Run over matrix layer
var theLayer = activeDocument.activeLayer;
var theParent = theLayer.parent;
if (theParent != activeDocument) {var theString = theParent.name+"-"+theLayer.name}
else {var theString = theLayer.name};

changeLayer(); ////// Choose target layer
function changeLayer(){
	var des = new ActionDescriptor();
	var list = new ActionList();
	var ref = new ActionReference();
	ref.putEnumerated( charIDToTypeID( "Lyr " ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Bckw" ));
	des.putReference( charIDToTypeID( "null" ), ref );
	list.putInteger( 3 );
	des.putList( charIDToTypeID( "LyrI" ), list );
	executeAction( charIDToTypeID( "slct" ), des, DialogModes.NO );
}

////////// Paste Name:
app.activeDocument.activeLayer.name = theString;