All options

Settings script with all available options and their defaults

#include "Batch Mockup Smart Object Replacement.jsx"

mockups([

  {
    output: {
      path: '$/_output',
      format: 'jpg',
      zeroPadding: true
      folders: false,
      filename: '@mockup - $',
    },
    mockupPath: '', 
    mockupNested: false, // If the above path leads to a folder
    input: '',    // If set, overrides smartObjects[].input, inputNested, and inputFormats. Every smart object picks files here sequentially.
    inputNested: false, 
    inputFormats: 'tiff?|gif|jpe?g|bmp|eps|svg|png|ai|psd|pdf',
    hideLayers: [],
    showLayers: [],
    noRepeats: false,
    smartObjects: [
      {
        target: '',
        nestedTarget: '',
        input: '',
        inputNested: false,
        inputFormats: 'tiff?|gif|jpe?g|bmp|eps|svg|png|ai|psd|pdf',
        align: 'center center',
        resize: 'fill',
        trimTransparency: true,
        inputPlaced_runScript: '',
        inputPlaced_runAction: [],
      },
      // {..},
    ]
  },
  
  // {..},
  
]);

Option

Description

output.path

output.format

Formats: jpg, png, tif, psd, pdf

output.zeroPadding

The padding is based on the amount of output images.

output.folders

Each mockup outputs into a subfolder inside the output path.

output.filename

Keywords: @mockup = mockup filename, @input = input filename. With multiple target smart objects the target with the most input files is used as the source. $ = incremental numbers. — You can customize this string basically however you want, like for example: "My mockups - @mockup - @input - $". Beware of duplicate filenames.

mockupPath

mockupNested

If your "mockupPath" points to a folder, this makes it search for PSD and PSB files from every nested folder.

input

This overrides the "input" setting in each smart object and instead sequentially distributes input files to the smart objects.

inputNested

Normally the script looks for files in the input folders and no further, but with this setting enabled, it will look for image files from every single subfolder.

inputFormats

Separate multiple formats with a vertical pipe. You shouldn't need to change this if you prep your input folders.

hideLayers

Array of strings with unique layer names. These layers are hidden before any replacements are made in the mockup.

showLayers

Array of strings with unique layer names. These layers are shown before any replacements are made in the mockup. Target smart object is always visible.

noRepeats

smartObjects

Array of objects. Each object represents one smart object target in the mockup.

smartObjects[].target

Unique smart object layer name.

smartObjects[].nestedTarget

smartObjects[].input

smartObjects[].inputNested

Normally the script looks for files in the input folders and no further, but with this setting enabled, it will look for image files from every single subfolder.

smartObjects[].inputFormats

Separate multiple formats with a vertical pipe. You shouldn't need to change this if you prep your input folders.

smartObjects[].align

Logic: 'x y'. Values: 'left top', 'left center', 'left bottom', 'right top', 'right center', 'right bottom', 'center top', 'center center', 'center bottom'

smartObjects[].resize

Values: false, 'fill', 'fit', 'xFill', 'yFill'

smartObjects[].trimTransparency

smartObjects[].inputPlaced_runScript

Trigger a script each time an input file is placed (still inside the smart object). You can use the scropt prefix: $/Input placed script.jsx

smartObjects[].inputPlaced_runAction

['folder name', 'action name']['Default Actions', 'Gradient Map']

Minimal settings script

This is the one I'd recommend you to use as a starting point. Use the one above as a reference only. It's easier to manage the settings script if you only include what you need.

#include "Batch Mockup Smart Object Replacement.jsx"

var outputOpts = {
  path: '$/_output',
};

mockups([
  
  {
    output: outputOpts,
    mockupPath: '$/mockup/file.psd',
    smartObjects: [
      {
        target: 'smart object layer name',
        input: '$/input',
      },
      // {..},  comma separate multiple smartobjects 
    ]
  },
  // {..},  comma separate multiple mockups 
  
]);

Last updated