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

Batch replace smart objects

Community Beginner ,
Jan 30, 2014 Jan 30, 2014

Copy link to clipboard

Copied

Hello,

I have very minimal scripting knowledge, and every script I've found for this workflow is partial or results in "undefined".  I am on a mac running Photoshop CC (latest update).

This is what I have:

  • a mockup file of a book with the cover image set as a transformed smart object
  • a folder of images resized to fit said smart object

This is what I would like a script to do (if possible):

  • for every image in said folder
  • replace smart object with images
  • save each new mockup (one for each new image) as a PSD file.

We have to create over 40 book, CD, DVD, and Blu-Ray mockups for each flyer we do.  Smart Objects help streamline it a little but I'm just going through and using an action right now, which I know is less than ideal.  I don't mind if the file names aren't what I need them to be, so incremental file naming would be fine because I could rename them all later.

Any suggestions on how I could streamline this process without having to manually replace and save?

TOPICS
Actions and scripting

Views

27.0K

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 , Feb 04, 2014 Feb 04, 2014

Please try this:

// replace smart object’s content and save psd;

// 2011, use it at your own risk;

#target photoshop

if (app.documents.length > 0) {

var myDocument = app.activeDocument;

var theName= myDocument.name.match(/(.*)\.[^\.]+$/)[1];

var thePath = myDocument.path;

var theLayer = myDocument.activeLayer;

// psd options;

psdOpts = new PhotoshopSaveOptions();

psdOpts.embedColorProfile = true;

psdOpts.alphaChannels = true;

psdOpts.layers = true;

psdOpts.spotColors = true;

// check if layer is smart object;

...

Likes

Translate

Translate
Community Beginner ,
Mar 11, 2018 Mar 11, 2018

Copy link to clipboard

Copied

I thought I’d quoted him, I must have missed 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