Skip to main content
Known Participant
May 13, 2021
Answered

Droplet using a .jsx action not working properly - every file has the same name!

  • May 13, 2021
  • 2 replies
  • 4475 views

Hello there,

 

I am trying to create a droplet where I can drop multiple files on it and it creates layer comps to JPGs. All is working fine except all of the files take on the filename of the first file! 

 

I figure I have to edit the .jsx file, but have no clue how to do that. Not sure if I should post the .jsx file here as it's pretty long. 

 

Does anyone have any ideas? 

This topic has been closed for replies.
Correct answer r-bin

At your own risk and peril 🙂

 

Make two changes to the script (save the original script of course)

 

1. Code replacement, original line 137

main();

on the code

main();
if (DialogModes.ALL == app.playbackDisplayDialogs) app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);

 

2. Code replacement, original line 177

    if ( DialogModes.ALL == app.playbackDisplayDialogs ) {
        if (cancelButtonID == settingDialog(exportInfo)) {
            return 'cancel'; // quit, returning 'cancel' (dont localize) makes the actions palette not record our script
        }
    }

on the code

    if ( DialogModes.ALL == app.playbackDisplayDialogs ) {
        if (cancelButtonID == settingDialog(exportInfo)) {
            return 'cancel'; // quit, returning 'cancel' (dont localize) makes the actions palette not record our script
        }
    }
    else {
        try {
            var tmp = app.activeDocument.fullName.name;
            exportInfo.fileNamePrefix = decodeURI(tmp.substring(0, tmp.indexOf("."))); // 1 body part
        } catch(someError) {
            exportInfo.fileNamePrefix = app.activeDocument.name; // filename body part
        }
    }

 

The prefix will always be the same as the file name. The rest of the parameters, including the save path, will be recorded in your Action that calls the script from which (from the Action) you will make the droplet.

Good luck 🙂

2 replies

Stephen Marsh
Community Expert
Community Expert
May 14, 2021

 

Similar to this other topic:

 

How to make a script for saving out multiple files with layer comps to JPEGs

 

EDIT: No surprise that the answer provided by @r-bin resulted in a perfect result compared to my hack!

 

Legend
May 13, 2021
Download the script for example on google drive and give a link here.
I don't think Edgar Cayce is here.
Known Participant
May 13, 2021

Thank you. Here is the link to the .jsx file:

 

Layer Comps To Files (Extended).jsx

 

 

Legend
May 26, 2021

If I wanted to do the same script but for Layer Compts To PDFs. What would I have to change?


The "Layer Comps To PDF.jsx" scripts differ in different versions of Photoshop.

Give a link to your script. Maybe I'll take a look.