Skip to main content
danielsian.com
Inspiring
December 4, 2018
Question

How can I detect if a save operation is in progress in Photoshop?

  • December 4, 2018
  • 2 replies
  • 1490 views

I have a script to save JPGs and I'd like to implement an IF statement before to start saving a new JPG.
If Photoshop is busy saving any file, wait, else save the new JPG.

Something like this:

function save(){

     var jpegSaveOptions = new JPEGSaveOptions( ); 

     jpegSaveOptions.embedColorProfile = true; 

     jpegSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE; 

     jpegSaveOptions.matte = MatteType.NONE; 

     jpegSaveOptions.quality = 10;   

     docRef.convertProfile("Adobe RGB (1998)", Intent.RELATIVECOLORIMETRIC);

     docRef.saveAs( finalJpg, jpegSaveOptions, true, Extension.LOWERCASE);

};

if (there is a document being saved){

     wait;

} else {

     save();

}


Any thoughts?

This topic has been closed for replies.

2 replies

Kukurykus
Legend
December 6, 2018

It's actually possible. I don't know if fully, but you can use for this BridgeTalk(). I'm not sure how to implement it now, but there are special commands, so when you ran a script that is reply to you of Photoshop status, like busy, free etc...

danielsian.com
Inspiring
December 8, 2018

Interesting!

Would be really nice to see how this BridgeTalk() could do the magic!

Legend
December 4, 2018
If you use doc.saveAs() to save the document, then after this function everything is already saved.
Nothing to check.
The script does not go to the next command until this is completed.

danielsian.com
Inspiring
December 5, 2018

Yes, I know that, but as we know sometimes Photoshop can be unstable during a saving process.
So, to get the ability to stop the script in order to make everything safe I still think it's worth.

Do you know any way to check this?

Legend
December 5, 2018

I think it is impossible. If any document continues to be saved in the background, then Photoshop itself will wait before starting to save any other document manually in the background or through a script, and even show progress for the waiting process.
You can of course, through a third-party external script, get a list of all windows in Photoshop and check if there is a header with the word "Saving" in any of them. But it is long in time, inconvenient and unreliable.