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 path is created automatically. Accepted prefixes: ., $../ can be used with the prefixes to traverse up in the folder structure. See Paths and prefixes for more info.

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

Path to the mockup psd. Accepted prefix: $ See Paths and prefixes for more info. If this path points to a folder rather than a PSD or PSB file, it will process all found mockup files with the same settings.

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

If a mockup has multiple smart object targets, the script makes sure each of them uses the same amount of input files by repeating the existing input files as many times as needed to match the target with the most files. See noRepeats logic for more info.

smartObjects

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

smartObjects[].target

Unique smart object layer name.

smartObjects[].nestedTarget

Is used to more accurately position input file inside a target smart object that has a lot of whitespace around it. More info here.

smartObjects[].input

Path to the input file folder. Use array of strings to set multiple input file paths; ["$/input-files/one/", "$/input-files/two/"] — Accepted prefix: $ and .../ can be used with the prefix to traverse up in the folder structure. See Paths and prefixes for more info.

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

Set this to false if you want resize to include transparent whitespace. Read more here.

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