Copy link to clipboard
Copied
I have come across several instances in Windows Photoshop CC 2015 when the palette buttons are unresponsive. The purpose of the palette in this case is to stall the application until a bat script completes while still giving the user the option to "cancel" if necessary.
I haven't had any success creating the palette window with and without BridgeTalk(). It almost seems like there is a ScriptUI parenting issue since the entire panel appears to be disabled. Please let me know if anyone has come across this issue or if there's a known workaround. Thanks!
Here's an example:
Ex)
function WinObject() {
var windowResource = "palette { orientation: 'column', alignChildren: ['fill', 'top'], preferredSize:[300, 130], text: 'ScriptUI Window - palette', margins:15, bottomGroup: Group{cancelButton: Button { text: 'Cancel', properties:{name:'cancel'}, size: [120,24]}} }";
var win = new Window(windowResource);
win.bottomGroup.cancelButton.onClick = function() {
scriptRunning = false;
win.close()
};
var scriptRunning = true;
win.show();
while (scriptRunning)
{
app.refresh();
}
win.close();
};
var message = WinObject.toString() + "\nnew WinObject();";
var bt = new BridgeTalk();
bt.target = "photoshop";
bt.body = message;
bt.onResult = function(obj)
{
alert("RECEIVE ON RESULT");
}
bt.send(5);
Copy link to clipboard
Copied
You usually only need to wait for a Bat file to complete when you need to use what the bat file or executable creates. What I do is set some up to something I can test for in the script the indicates that process has completed. I loop the script looking for the signal Then put out an alert Thes process did not complete yet. This Alert paused the script. When the user dismisses the alert I test again. It the signal has happened during the alert I continue else I abort.
StartPgm(path,program,options,pbmName); // Create eps file
app.refresh(); // slow down Photoshop with a refresh
for (var i=0;i<100000;i++) { if (!testeps.exists) break; } // wait a short time before forcing a pause
if (!testeps.exists) {alert('File "' + testeps + '" was not cteated yet'); } // force a pause
if (!testeps.exists) {alert('File "' + testeps + '" was not cteated'); return;}
Copy link to clipboard
Copied
yes, I suppose that's a valid workaround. I was really hoping to get this to work with the palette in order to give the user more control.