Linking Layers in Macro

New Here ,
May 12, 2021 May 12, 2021

Copy link to clipboard

Copied

I'm tryiong to create a macro that will duplicate the selected layer and then link the copy and original together. It's working fine, unless the original layer is already linked to another. In such a case it unlinks the original layer.

 

Anyone know why the "Link Selected Layers" command is unlinking, or have a work-around for this?

TOPICS
Actions and scripting, Problem or error

Views

1.8K

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 2 Correct Answers

Adobe Community Professional , May 12, 2021 May 12, 2021
If the layer was already linked with others, it is going to prevent from unlinking it (while linking with its copy): (aL = (aD = activeDocument).activeLayer).link(aL.duplicate())

Likes

Translate

Translate
Adobe Community Professional , May 12, 2021 May 12, 2021
Save it in a file with any name that have .jsx extension. Then you can either move it to Presets / Actions of your Ps folder to Insert Menu Item from File / Scripts in (restarted) Ps or keep in other place to choose .jsx file from disk by File / Scripts menu item when recording an action.

Likes

Translate

Translate
Adobe Community Professional ,
May 12, 2021 May 12, 2021

Copy link to clipboard

Copied

If the layer was already linked with others, it is going to prevent from unlinking it (while linking with its copy):

 

(aL = (aD = activeDocument).activeLayer).link(aL.duplicate())

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
New Here ,
May 12, 2021 May 12, 2021

Copy link to clipboard

Copied

I don't know how to implement this into my Recorded Action.

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
Adobe Community Professional ,
May 12, 2021 May 12, 2021

Copy link to clipboard

Copied

Save it in a file with any name that have .jsx extension. Then you can either move it to Presets / Actions of your Ps folder to Insert Menu Item from File / Scripts in (restarted) Ps or keep in other place to choose .jsx file from disk by File / Scripts menu item when recording an action.

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
Adobe Community Professional ,
May 12, 2021 May 12, 2021

Copy link to clipboard

Copied

 

More info on saving and installing/running scripts here:

 

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html

 

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
Adobe Community Professional ,
May 12, 2021 May 12, 2021

Copy link to clipboard

Copied

 

What's wrong with the layer > duplicate layer command?

 

I tested with 2 layers linked together. Then selected the top layer and duplicated. The result was that all three layers were linked, the original link between the 2 layers was not lost.

 

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
Adobe Community Professional ,
May 12, 2021 May 12, 2021

Copy link to clipboard

Copied

LATEST

After duplication of a layer, select original with a copy and link them. Original one gets unlinked.

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