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

Can I duplicate groups contain Smart Objects but Make a New S.O via Copy for the same time?

New Here ,
Jul 01, 2024 Jul 01, 2024

Copy link to clipboard

Copied

I'm trying to make somethings like a league schedule with logos (a smart object (S.O) can change the logo), each group for one game. Then I duplicate the group, but all the S.O are linked (change one is change all), I have to use Make a New Smart Object via Copy for every single S.O and it takes some times. 

 

CAN I DUPLICATE A GROUP, THAT ALSO MAKE A NEW SMART OBJECT VIA COPY FOR EVERY SINGLE S.O IN THE GROUP, FOR THE SAME TIME?

TOPICS
Windows

Views

115

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 , Jul 01, 2024 Jul 01, 2024

@huyct1507 

 

You can try this:

 

/*
Dupe Selected Group and All Smart Objects as Copies.jsx
v1.0, 1st July 2024 - Stephen Marsh
https://community.adobe.com/t5/photoshop-ecosystem-discussions/can-i-duplicate-groups-contain-smart-objects-but-make-a-new-s-o-via-copy-for-the-same-time/td-p/14712098
*/

#target photoshop

app.activeDocument.suspendHistory ("Dupe Selected Group and All Smart Objects as Copies...", "main()");

function main() {

    if (app.documents.length === 0) {
        alert("A d
...

Votes

Translate

Translate
Adobe
Community Expert ,
Jul 01, 2024 Jul 01, 2024

Copy link to clipboard

Copied

LATEST

@huyct1507 

 

You can try this:

 

/*
Dupe Selected Group and All Smart Objects as Copies.jsx
v1.0, 1st July 2024 - Stephen Marsh
https://community.adobe.com/t5/photoshop-ecosystem-discussions/can-i-duplicate-groups-contain-smart-objects-but-make-a-new-s-o-via-copy-for-the-same-time/td-p/14712098
*/

#target photoshop

app.activeDocument.suspendHistory ("Dupe Selected Group and All Smart Objects as Copies...", "main()");

function main() {

    if (app.documents.length === 0) {
        alert("A document must be open to run this script!");
        // End the script
        return;
    }

    var selectedLayerSet = app.activeDocument.activeLayer;
    if (!(selectedLayerSet instanceof LayerSet)) {
        alert("A layer group must be selected to run this script!");
        // End the script
        return;
    }
    var duplicatedLayerSet = selectedLayerSet.duplicate();
    duplicatedLayerSet.name = selectedLayerSet.name + " copy";
    processActiveGroup(duplicatedLayerSet);


    // Functions

    function processActiveGroup(layerSet) {
        for (var i = layerSet.layers.length - 1; i >= 0; i--) {
            var theSOLayer = layerSet.layers[i];
            if (theSOLayer.kind === LayerKind.SMARTOBJECT) {
                dupeSOasCopy(theSOLayer);
            } else if (theSOLayer.typename === "LayerSet") {
                processActiveGroup(theSOLayer);
            }
        }
    }

    function dupeSOasCopy(theLayer) {
        app.activeDocument.activeLayer = theLayer;
        executeAction(stringIDToTypeID("placedLayerMakeCopy"), undefined, DialogModes.NO);
        var theNewLayer = app.activeDocument.activeLayer;
        // Depends on layer panel options for adding copy
        theNewLayer.name = theLayer.name; //+ " copy";
        theLayer.remove();
    }

}

 

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

 

Votes

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