Automating Production (Paths & Layers)
I have been reading and trying to figure this out, and I get the big pieces just not how to put them together, so thanks in advance for your help.
I am trying to integrate JS scripts and actions to create a production workflow for product shots. The issue is over the years the way people have left our master Photoshop files is far from consistent.
(These can be separate scripts if necessary so please chime in even if you know how to just do one of the 2 tasks)
I have almost everything working and these are the last 2 tasks I need to accomplish.
A.Need to see if there is a work path and if so:
- save that path (The name of this path is not important.)
- If there is no work path then skip to the next step.
(Manually you do this by double clicking the work path or dragging it on to the "new path icon" by Default if no other paths exist it is named Path 1, if there are other paths it is named with the next availble numerical path number Path 2, Path 3 etc.)
I found this snippet and I am trying to modify it, but can't quite figure it out
if (app.documents.length > 0) {
var docRef = app.activeDocument;
var n = docRef.pathItems.length;
if((n>0)&&(docRef.pathItems[0].name!="Work path" ))
This looks like it is looking for path names OTHER THAN work path, but I'm not 100% sure.
I also tried scriptlistener to see what came up when I saved the Work Path manually and this is whay I got. It makes no sense to me.
var idMk = charIDToTypeID( "Mk " );
var desc6 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref4 = new ActionReference();
var idPath = charIDToTypeID( "Path" );
ref4.putClass( idPath );
desc6.putReference( idnull, ref4 );
var idFrom = charIDToTypeID( "From" );
var ref5 = new ActionReference();
var idPath = charIDToTypeID( "Path" );
var idWrPt = charIDToTypeID( "WrPt" );
ref5.putProperty( idPath, idWrPt );
desc6.putReference( idFrom, ref5 );
var idNm = charIDToTypeID( "Nm " );
desc6.putString( idNm, "Path 1" );
executeAction( idMk, desc6, DialogModes.NO );
2. I need to create a script that identifies if the top most layer is a standard layer or adjustment layer. If it is a standard layer move on, if it is an adjustment layer then:
- Select topmost layer
- "Stamp Visible"
- turn off all other layers
- save(without dialog) and end.
To clarify here is an example.
This is how the final files should look.

This is how they sometimes look when someone hasn't correctly completed the file.

I can do a lot of other actions to kind of work around this, but in the end I want my file to be correct.
Any help would be appreciated. Even if it is just to point me in the right direction to find the info myself.
![]()