Skip to main content
longh79636908
Participant
July 17, 2015
Question

How do I replace smart object with data-driven graphic variable in Photoshop CS6?

  • July 17, 2015
  • 3 replies
  • 3142 views

Hi, here's a screenshot of my problem:

http://imgur.com/wLsRbrZ

Basically I can't define the smart object which is the pillow design layer as a graphic variable to apply multiple design picture on it, please help

This topic has been closed for replies.

3 replies

pablog16361564
Participant
June 26, 2016

Hello Philip Cord and longh79636908  Sorry you open an old thread , but I'm having the same problem and it is not clear if it could resolve ... To me I get the same error.
I do not understand how it should run the script to work. I modified only three lines (can be seen in the catch) . I need to use the Smart Object layer as Pixel Replacement . It can be done with this script? Thank you very much!

JJMack
Community Expert
Community Expert
June 26, 2016

You can not replace a smart object layer object with Photoshop Data Driven Graphics that feature can replace Pixel layers and text layers.  This was pointed out in my first append here. You can see that from your screen capture where you trying to define a variable for the smart object layer named smart. You highlighted there is no replace text or Pixels options. Smart object layers pixels can not be modified. Data driven graphics does not support replace object.  The Associated transform would not work any size replacement.

Replacing a smart Object Layer'd Object requires a Script or the use of Photoshop's UI.  The replacement object must also be the exact same size as the object being replaced.  For every smart object layer has an associated transform.  When you replace the layers object the associated transform is not modified.  For the transform to work correctly the replacement object must be the same size layers original object.

With Data driven graphics when you replace a pixel layer there are sizing and alignment options.

The script is not related to Data Driven Graphics and getByName may fail.  The may be something in your document that could be causing a problem. I can not see all the layer in you Document because many groups are contracted.  I saw user having Problems with getByNamet in my search.

https://forums.adobe.com/search.jspa?place=%2Fplaces%2F1383833&q=getbyname

JJMack
c.pfaffenbichler
Community Expert
Community Expert
July 17, 2015

This may need a custom Script.

longh79636908
Participant
July 17, 2015

How can I set up a script like that, any suggestion ?

Inspiring
July 17, 2015

Here is a basic script that will require modification for the type of input files and the output file type.

This example uses jpg for input and save as png

#target photoshop;

app.bringToFront();

main();

function main(){

if(!documents.length) return;

var sourceFolder = Folder.selectDialog( "Please select input folder");

if(sourceFolder == null) return;

var outputFolder = Folder.selectDialog( "Please select output folder");

if(outputFolder == null) return;

var fileList = sourceFolder.getFiles("*.jpg"); //amend to suit

for(var z in fileList){

    activeDocument.activeLayer = activeDocument.artLayers.getByName("pillow design");

    replaceSO(fileList);

    activeDocument.activeLayer.name = "pillow design";

    var Name = decodeURI(fileList.name).replace(/\.[^\.]+$/, '');

    var saveFile = new File(outputFolder + "/Pillow-" + Name + ".png"); //amend ext to suit

    savePNG(saveFile); //amend to suit

    }

};

function savePNG(saveFile){ //amend to suit

    pngSaveOptions = new PNGSaveOptions();

activeDocument.saveAs(saveFile, pngSaveOptions, true, Extension.LOWERCASE);

};

function replaceSO(SO){

var desc = new ActionDescriptor();

desc.putPath( charIDToTypeID( "null" ), new File( SO ) );

executeAction( stringIDToTypeID( "placedLayerReplaceContents" ), desc, DialogModes.NO );

};

JJMack
Community Expert
Community Expert
July 17, 2015

A Smart Object layers Pixels can not be altered They are rendered by Photoshop for the smart object.  So you can not use a smart object late as a variable layer.  You would need to replacet the smar object content data-driven graphics does not support that. It just supports replacing text and pixels.

JJMack