Skip to main content
Community Expert
May 30, 2026 1:11 PM UTC
Question

Save changes on images coming from Lightroom via script/action

I don't have much experience with script programming in Photoshop yet. So i have a question to the script professionells.

A image was send via “Edit in Photoshop” from Lightroom Classic to Photoshop.

After doing the appropriate changes and editing I like to save and send back the image back to Lightroom with the same name as the original file and in the same folder.. Normally i click on Photoshop’s menu File - Save. I try to do thi with an action or a script.

All attempts so far have failed. Either the user is prompted for a filename, or the photo is saved without such a prompt—but in the wrong directory, as no corresponding query was issued.

My question is how can I simulate the function of the click on File-Save on an image that came from Lightroom.   

I’m on Windows 11 and use Photoshop 27.7 and Lightroom 15.3.1

 

    5 replies

    AxelMattCommunity ExpertAuthor
    Community Expert
    Jun 29, 2026 8:44 AM UTC

    I haven't quite given up on this yet. I’ve tested various options, but I’m not making any success.


    What I’ve noticed is that, when I check the name and path of the image sent from LR to PS via script, I only get the name; the path is empty. And I think that’s likely the problem.

     

    Does anybody does have any hints and can give me some hints?

     

    Translate
    My System: Intel i7-8700K - 64GB RAM - NVidia Geforce RTX 3060 - Windows 11 Pro 26H2 -- LR-Classic 15 - Photoshop 27 - Nik Collection 9 - PureRAW 6 - Topaz Photo AI
    Stephen Marsh
    Community Expert
    Community Expert
    May 30, 2026 11:54 PM UTC

    In an action, try using the “Insert menu item” command and select File  > Save (probably followed by Close).

     

    You can also try recording Close with Save on an edited doc.

     

    As for scripting, there’s legacy ExtendScript DOM code:

     

    app.activeDocument.save();

     

    Or:

     

    app.activeDocument.close(SaveOptions.SAVECHANGES);

     

    Or legacy ExtendScript AM code for save:

     

    executeAction( charIDToTypeID( "save" ), undefined, DialogModes.NO );

     

    And close with save:

     

    var idCls = charIDToTypeID( "Cls " );
    var desc274 = new ActionDescriptor();
    var idDocI = charIDToTypeID( "DocI" );
    desc274.putInteger( idDocI, 59 );
    var idforceNotify = stringIDToTypeID( "forceNotify" );
    desc274.putBoolean( idforceNotify, true );
    executeAction( idCls, desc274, DialogModes.NO );

     

    (I don’t use Lr, so I can’t test… If these don’t work, keep in mind that some things may require a macro program to record and playback keystrokes and or mouse movements)

    Translate
    AxelMattCommunity ExpertAuthor
    Community Expert
    May 31, 2026 2:08 PM UTC

    ...

    You can also try recording Close with Save on an edited doc.

    ...

     

    ​@Stephen Marsh Thanks for your reply.

    This was the first that I’ve tried, but I doesn’t worked as I wanted. 

    The edited image would save to Lightroom, but on execution of  “Close” the “File Save” - dialog was shown.

    In the meantime I’ve tried several methods, but nothing worked.

    I’ll try your hints in the next few days and give a feedback.

     

     

     

    Translate
    My System: Intel i7-8700K - 64GB RAM - NVidia Geforce RTX 3060 - Windows 11 Pro 26H2 -- LR-Classic 15 - Photoshop 27 - Nik Collection 9 - PureRAW 6 - Topaz Photo AI
    Stephen Marsh
    Community Expert
    Community Expert
    May 31, 2026 2:22 PM UTC

    The AM code has DialogModes.NO rather than .ALL so you shouldn’t get a window popping up.

    Translate