Skip to main content
Known Participant
July 29, 2007
Question

Executing bridgetalk messages from a modal dialog

  • July 29, 2007
  • 5 replies
  • 1175 views
I have a script that runs a BridgeTalkLongProcess from an onClick event within a modal dialog. This worked well in CS2, but not in CS3. The BridgeTalkLongProcess does run, but not until the modal dialog closes. The BridgeTalkLongProcess is attempting to run a process in Photoshop (the target)from Bridge.

Any tips on how to work around this. Do I have to convert the dialog to a palette? Why the change from the CS2 behavior?

TIA
Rory
This topic has been closed for replies.

5 replies

Participating Frequently
November 30, 2008
Thanks

Good Luck.
______
My Si tes
September 18, 2007
Rory, David,

In CS2, BridgeTalkLongProcess worked with a dialog showing, in CS3, it doesn't. Obviously, something changed. I didn't spend any time to figure out specifically why, but it makes sense that the onResult handler doesn't fire until the dialog is dismissed.

Regards

Bob
dfranzen_camera_raw
Adobe Employee
Adobe Employee
September 17, 2007
Rory,

I had some more time to investigate this issue today, looking for the underlying bug.

I now think my first advice (to use a scheduled task) was probably unhelpful--sorry. I have observed the following behavior sending BridgeTalk messages from button onSelect handlers in modal dialogs. If the onSelect handler sends the BridgeTalk message to Photoshop, the message is sent immediatelyy, but the BridgeTalk object's onResult handler is not called until the modal dialog box closes. If the onSelect handler schedules a task to send the BridgeTalk message, then the message is not sent until the dialog box closes.

I am actually not very familiar with the AdobeLibraryN.jsx scripts, but I took a quick look at the BridgeTalkLongProcess class in the AdobeLibrary1.jsx that was in your zip and it looks to me like it may rely on getting a call to the onResult handler to work as designed. That may be why your script appears to hang--we're waiting on onResult, and that does not execute until the dialog closes.

For now I reccomend that you try a work-around that will dismiss the modal dialog before you make any BridgeTalk calls to Photoshop.

Thanks,
David Franzen
Quality Engineer
Adobe Systems, Inc.
hillrgAuthor
Known Participant
July 31, 2007
Thanks David - I tried your suggestion with the same results.

If you would like to see the code that is causing the problem, it is at http://members.shaw.ca/hillrg/Ditto114.zip. The zip includes a readme file with installation instructions. A description of what the script does is at http://members.shaw.ca/hillrg/ditto/.

The problem shows up when you open the template editor dialog and click "Save template and Test". This runs the function Ditto.executeTemplate(), which works when executed outside the dialog.

I tried using the BridgeTalkLongProcess in WasScriptLibrary, instead of AdobeLibrary1, with the same results.

Some erratic panel border drawing is also manifesting itself in this script, which worked in CS2.

This is a good test script for the ESTK, as it includes a very complex dialog and several bridgetalk implementations, including a progress palette.

The script is freeware and can be used and changed by anyone.

Regards
Rory
dfranzen_camera_raw
Adobe Employee
Adobe Employee
July 30, 2007
Rory,

I will look into this to see if it's a bug, but one thing you can try is to move the work out of the onClick() event handler. Instead try making the onClick() event handler call app.scheduleTask(). This will allow the event handler to return, the window to close, and the rest of your script to execute next.

You have to pass schedule task literal JavaScript to execute, so I try to keep it brief by creating a new function that does the work and just passing a literal function call in app.scheduleTask().

For example if the onClick() handler looks like this:

myButton.onClick = function() {
// do a bunch of stuff here
};

Create a function like...

var doMyBridgeTalkLongProcess = function() {
// do a bunch of stuff here
};

And change the event handler to...

myButton.onClick = function() {
app.scheduleTask( "doMyBridgeTalkLongProcess();", 0, false );
};

Let me know if this works for you,
David Franzen
Adobe Bridge Quality Engineer
Adobe Systems, Inc.