ebanat@adobeforums.com wrote:
>
> ESC-ESC-ESC-ESC-ESC-ESC-ESC-ESC
>
> ok its good, thanks
Sometimes you have to repeat yourself with ScriptUI to make yourself heard :)
>
> In my first message attempt of a write of such dialogue (a progressbar I have removed - with it there are no problems).
My implementation is below.
> Difficulty that "beach ball" does not allow the user to press the button.
I've had mixed results. In some scripts it works fine, in others, not at all.
And it varies across Adobe Apps and versions and which OS you happen to be
running on.
Bob Stucky may have a better threaded solution from some of the Bridge UI work
that he's done in the past.
Yet another way of tackling the problem is to have the progress bar UI running
in Bridge. The ID script would launch the progress UI via BridgeTalk and have to
periodically check and update that UI. This has the added advantage that the
progress bar is in a completely separate process from ID so there is no UI
contention going on. I never got around to implementing it, though, as the need
was never really there.
//
// createProgressPalette
// title the window title
// min the minimum value for the progress bar
// max the maximum value for the progress bar
// parent the parent ScriptUI window (opt)
// useCancel flag for having a Cancel button (opt)
//
// onCancel This method will be called when the Cancel button is pressed.
// This method should return 'true' to close the progress window
//
function createProgressPalette(title, min, max,
parent, useCancel) {
var win = new Window('palette', title);
win.bar = win.add('progressbar', undefined, min, max);
win.bar.preferredSize = [300, 20];
win.parentWin = undefined;
win.recenter = false;
win.isDone = false;
if (parent) {
if (parent instanceof Window) {
win.parentWin = parent;
} else if (useCancel == undefined) {
useCancel = !!parent;
}
}
if (useCancel) {
win.onCancel = function() {
this.isDone = true;
return true; // return 'true' to close the window
}
win.cancel = win.add('button', undefined, 'Cancel');
win.cancel.onClick = function() {
var win = this.parent;
try {
win.isDone = true;
if (win.onCancel) {
var rc = win.onCancel();
if (rc != false) {
win.close();
}
} else {
win.close();
}
} catch (e) {
alert(e);
}
}
}
win.onClose = function() {
this.isDone = true;
}
win.updateProgress = function(val) {
var win = this;
if (val != undefined) {
win.bar.value = val;
}
if (win.recenter) {
win.center(win.parentWin);
}
win.show();
win.hide();
win.show();
}
win.recenter = true;
win.center(win.parent);
return win;
};