Photoshop with a dialog open

General Discussion of Scripting for Adobe Bridge

Moderators: Tom, Kukurykus

Rory

Photoshop with a dialog open

Post by Rory »

If I run my Ditto script from Bridge, which in turn runs a photoshop script, and Photoshop has an open dialog, then the Bridge script will not work because Photoshop "attention" is locked on the open dialog.

Is there any way I can find out in advance, within Bridge, whether Photoshop is "available" - open but with its focus locked.

Rory
xbytor

Photoshop with a dialog open

Post by xbytor »

The way I have done this in other systems is (in Bridge) to send a message to PS. The message to PS is to send a response back. If you don't get a response back in a certain time frame, you can assume PS is blocked in a dialog.

Or, in other words, first send a request from which you expect an immediate response. If you don't get the response, PS is blocked.

-X
hillrg

Photoshop with a dialog open

Post by hillrg »

Thanks X. That will work I think. I'll play with it.
hillrg

Photoshop with a dialog open

Post by hillrg »

Here is my solution. Thanks for the help!

#target bridge
var isPhotoshopBusy = true;
var bt = new BridgeTalk;
bt.target = "photoshop";
bt.body = "app.name";

bt.onResult = function(msg) {
isPhotoshopBusy = false;
$.writeln('Return from Photoshop');
}

bt.onError = function(msg) {
$.writeln('error');
}

bt.send();
$.writeln('isPhotoshopBusy: ' + isPhotoshopBusy);
for (var i=0; i < 10; i++) {
$.sleep(100);
BridgeTalk.pump();
if (!isPhotoshopBusy) break;
}
$.writeln('Slept');
if(isPhotoshopBusy)
alert('Photoshop is busy. Check if a dialog is open.');
else {
alert('Photoshop was not busy');
}