Copy link to clipboard
Copied
Hello, I have a Mockup script, that:
1. Dublicates a layer from a Smart object to the first document.
2. Saves main documents PSD file with duplicated file name in a folder. (this is the problem).
3. Then the script deletes that duplicated layer from the main document.
4. Saves JPG.
The problem is that saving a PSD file takes a very long time. And the script does this just to get the name of a layer in a Smart object.
So, my question is:
Is it possible to do the scripts and actions like this:
1. Goes to Smart object.
2. Gets first layer name, makes first layer visible, updates smart object.
3. Gets needed group name from the main document.
4. 2.Name + 3.Name and Saves as JPG.
How it looks in pictures:
1. The main document layout.
2. Smart object layout.
JPG should be saved as (for example): Layer6Group8.jpg
Copy link to clipboard
Copied
Why do you need duplicate layer if you only want to know layer name?
I would do it like this:
1) make array for layer names
2) open smart object
3) asign all names into array variable
4) rename all groups to e.g. Layer6Group8.jpg - values from array
5) set in preferences fast export to JPG
6) select all groups
7) run this command for fast export... it should be very fast
var idslct = charIDToTypeID( "slct" );
var desc23 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref13 = new ActionReference();
var idMn = charIDToTypeID( "Mn " );
var idMnIt = charIDToTypeID( "MnIt" );
var idexportSelectionAsFileTypePressed = stringIDToTypeID( "exportSelectionAsFileTypePressed" );
ref13.putEnumerated( idMn, idMnIt, idexportSelectionAsFileTypePressed );
desc23.putReference( idnull, ref13 );
executeAction( idslct, desc23, DialogModes.NO );
Problems:
1) it only saves content in group croped according transparent pixels
2) only one saved JPG per folder - or if you want save only single layer, you can rename layers. Otherwise you need multiple loops.