Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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...
Copy link to clipboard
Copied
Interesting!
Would be really nice to see how this BridgeTalk() could do the magic!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now