Duplicate layer when a file are open

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

ivotavaresnet
Posts: 1
Joined: Sat Sep 12, 2020 5:14 pm

Duplicate layer when a file are open

Post by ivotavaresnet »

Hello there.

When I start edit an image the first think I do is to duplicate the "background image", I use the cmd+j.
Anyone know any script/plugin to duplicate a layer when the file tiff are open and don't exist more than the original "Background" image.

:)
User avatar
Kukurykus
Posts: 528
Joined: Mon Jul 25, 2016 12:36 pm

Re: Duplicate layer when a file are open

Post by Kukurykus »

Code: Select all

if (documents.length && (lrs = (aD = activeDocument).layers).length < 2 && (lyr = lrs[0]).isBackgroundLayer) aD.activeLayer = lyr.duplicate()
User avatar
txuku
Posts: 136
Joined: Thu Jan 01, 1970 12:00 am

Re: Duplicate layer when a file are open

Post by txuku »

Bonjour

Excellent! ! :)