Closed joonaspaakko closed 3 years ago
Output filename
keyword @input
has now been added. The input filename is taken from whichever smart object that has the most input files.
Example where I added comments to all the important parts:
#include "Batch Mockup Smart Object Replacement.jsx"
var output = {
path: '$/_OUTPUT',
format: 'jpg',
folders: true,
// If you add incremental numbers using the dollar symbol ($), you don't have to worry
// about input files with duplicate filenames getting overwritten... But it's not necessary...
filename: '@input - $',
};
mockups([
{
output: output,
mockupPath: '$/Mug PSD MockUp 2/Mug PSD MockUp 2.psd',
noRepeats: true,
smartObjects: [
{
target: '@black-mug',
// If you use an array of input files, you can easily end up with duplicate filenames without realizing...
// In this scenario the script would use input filenames from this "@black-mug" smartobject since it has more input files than '@white-mug'
input: [
'./_input files/black-mug',
'./_input files/white-mug'
],
// This setting can also cause accidental duplicates...
inputNested: true,
trimTransparency: false,
resize: false,
},
{
target: '@white-mug',
input: './_input files/white-mug',
nestedTarget: 'Placeholder',
resize: 'fit',
align: 'center bottom',
}
]
},
]);
After this question (#5) I thought about it some more and came to the conclusion that it could be done in all situations and batch renaming the output files afterwards is a bit too cumbersome given how easy it would be to add in the script.
The working idea and caveats:
target
with the most input files.input: [ 'path-1', 'path-2']
, there can't be any duplicate filenames between these folders.inputNested: true