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

Community Beginner ,
May 13, 2021 May 13, 2021

Copy link to clipboard

Copied

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? 

TOPICS
Actions and scripting

Views

1.7K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct Answer

Adobe Community Professional , May 13, 2021 May 13, 2021
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' (d...

Likes

Translate

Translate
Adobe Community Professional ,
May 13, 2021 May 13, 2021

Copy link to clipboard

Copied

Download the script for example on google drive and give a link here.
I don't think Edgar Cayce is here.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 13, 2021 May 13, 2021

Copy link to clipboard

Copied

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

 

Layer Comps To Files (Extended).jsx

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 13, 2021 May 13, 2021

Copy link to clipboard

Copied

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 🙂

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 14, 2021 May 14, 2021

Copy link to clipboard

Copied

@r-bin Thank you, I will def. try this! I will report back!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 14, 2021 May 14, 2021

Copy link to clipboard

Copied

@r-bin IT WORKED!!!!!! I can't thank you enough for your help!!!!! Thank you Thank you Thank you! 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 26, 2021 May 26, 2021

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 26, 2021 May 26, 2021

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 26, 2021 May 26, 2021

Copy link to clipboard

Copied

Thanks @r-bin 

 

The link below is to the script.

Layer Comps To Files (Extended).jsx

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 13, 2021 May 13, 2021

Copy link to clipboard

Copied

@jackieg25153876 

 

Do you have a link to where that "extended" script came from?

 

I don't really like/trust that www.uncorp.net  site...

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 14, 2021 May 14, 2021

Copy link to clipboard

Copied

@Stephen_A_Marsh  Yes, I got it from here: photoshopscripts

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 26, 2021 May 26, 2021

Copy link to clipboard

Copied

You have given a script the same as that of the author of the topic, only it has been corrected.

You need to create a new action in which you record the script call. Specify the output format in the script dialog - PDF. Create a new droplet from this action.

 

..

Or I didn't understand the problem.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 26, 2021 May 26, 2021

Copy link to clipboard

Copied

I may have explained it wrong. I tried this and it saved out the layer comps as separate PDFs. I would want the PDF to be saved out with all layer comps in one PDF. 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 26, 2021 May 26, 2021

Copy link to clipboard

Copied

I don’t know anything about the PDF format. Even Photoshop does not work directly with it.

Can a PDF contain LayerComps?

Unfortunately, I do not understand what this is about and I can hardly help.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 26, 2021 May 26, 2021

Copy link to clipboard

Copied

@r-bin Would love your help on this, as I am having the same problem. 

 

I created an action using File/export/Layer Comps to PDFs. That works perfectly when I run it on 1 file at a time. When I run the action on more than 1 file at a time, each filename saves over the last, just like what happened with the Layer Comps to Files script. I actually tried to replace the code with how you suggested it for the first time, and when I did that, and ran the action again the file name ended up being replace with untitled.pdf lol 

I can upload the file if you wouldn't mind taking a look as you hit it out of the park the last time!!!

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 26, 2021 May 26, 2021

Copy link to clipboard

Copied

Yes, upload your version of the "Layer Comps To PDF.jsx" file that I requested.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 26, 2021 May 26, 2021

Copy link to clipboard

Copied

Thanks @r-bin 

Here is the link to the file on my gmail drive:  Layer Comps To PDF.jsx

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 26, 2021 May 26, 2021

Copy link to clipboard

Copied

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 26, 2021 May 26, 2021

Copy link to clipboard

Copied

LATEST

@r-bin  THANK YOU! I'll keep you posted!

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 13, 2021 May 13, 2021

Copy link to clipboard

Copied

 

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!

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines