Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

Explorer ,
Dec 04, 2018 Dec 04, 2018

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?

TOPICS
Actions and scripting
1.5K
Translate
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
People's Champ ,
Dec 04, 2018 Dec 04, 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.

Translate
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
Explorer ,
Dec 04, 2018 Dec 04, 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?

Translate
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
People's Champ ,
Dec 05, 2018 Dec 05, 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.

Translate
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
Explorer ,
Dec 06, 2018 Dec 06, 2018

that's a shame. Photoshop should have a way to tell you if the system is busy or saving anything...

Anyway, thanks for your time again!

Cheers

Translate
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
LEGEND ,
Dec 06, 2018 Dec 06, 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...

Translate
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
Explorer ,
Dec 08, 2018 Dec 08, 2018
LATEST

Interesting!

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

Translate
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