0

I need to copy in Photoshop the name of the selected or active layer composition to the clipboard. I would like to do this with a script.

Unfortunately, I don't know much about coding and I can't find a solution. Could someone help me? Thank you very much in advance for your help.

Artur
  • 1

1 Answers1

0

You didn't mention what OS you are using... and it does matter in this case.

Whilst this works, it's using Visual Basic Script and ahem, Internet Explorer - but it works (unless you're on a Mac)

Ordinarily I'd use JavaScript for Photoshop scripting, but I don't think you can access the clipboard from there.

The code is straightforward, but the mechanics ugly

Dim appRef
Set appRef = CreateObject( "Photoshop.Application" )

' Switch off any dialog boxes
appRef.displayDialogs = 3 

appRef.BringToFront

' call the source document
Dim srcDoc
Set srcDoc = appRef.ActiveDocument

Dim layerName : layerName = appRef.ActiveDocument.ActiveLayer.name

' Wscript.Echo layerName 

Set objIE = CreateObject("InternetExplorer.Application")
objIE.Navigate("about:blank")
objIE.document.parentwindow.clipboardData.SetData "text", layerName
objIE.Quit
Ghoul Fool
  • 6,249
  • 10
  • 67
  • 125