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

Script : paste Clipboard text

Explorer ,
Jan 17, 2023 Jan 17, 2023

Copy link to clipboard

Copied

Hello,

 

I found how to copy the layer name to clipboard, but I can't find how to paste it... !

Any ideas ? Thank you

Antoine

TOPICS
Actions and scripting

Views

276

Likes

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

correct answers 1 Correct answer

Community Expert , Jan 17, 2023 Jan 17, 2023

save selected layer name to Photoshop enviroment variables:

$.setenv ('layerName', activeDocument.activeLayer.name)

 

assign saved name to selected layer from enviroment variables:

activeDocument.activeLayer.name= $.getenv('layerName')

 

That is, you need to save both scripts to the photoshop presets/scripts folder. Record the first script call at the beginning of the first action - it will keep the current name. Record the second script at the end of the second action - it will restore it.

Likes

Translate

Translate
Community Expert ,
Jan 17, 2023 Jan 17, 2023

Copy link to clipboard

Copied

As a rule, the script does not need a clipboard. You can store the layer name in a variable and then assign it to another layer.

 

If you mean something else, please tell us more.

Likes

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
Explorer ,
Jan 17, 2023 Jan 17, 2023

Copy link to clipboard

Copied

Thank you for your answer jazz-y

I'm doing some actions and I need to copy the layer name, play some actions (that change temporary the layer name) and at the end rename the layer with paste. So I was thinking to use one script to copy, and one to paste so I loose the name. 

Did you have an easy idea ?

Likes

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 ,
Jan 17, 2023 Jan 17, 2023

Copy link to clipboard

Copied

save selected layer name to Photoshop enviroment variables:

$.setenv ('layerName', activeDocument.activeLayer.name)

 

assign saved name to selected layer from enviroment variables:

activeDocument.activeLayer.name= $.getenv('layerName')

 

That is, you need to save both scripts to the photoshop presets/scripts folder. Record the first script call at the beginning of the first action - it will keep the current name. Record the second script at the end of the second action - it will restore it.

Likes

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
Explorer ,
Jan 17, 2023 Jan 17, 2023

Copy link to clipboard

Copied

LATEST

It works !! Thank you very much for your help.

Likes

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 ,
Jan 17, 2023 Jan 17, 2023

Copy link to clipboard

Copied

app.document.paste() is a legal method, have you tried that?

Likes

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