I'm working on a photoshop script that contains a GUI for collecting information. This is my first time using Script UI and I'm running into 2 issues that I'm not sure how to address.
- Issue 1, the palette is not the focus when I run my script. The user has to manually click on the palette in order to focus it and input their information. Not a super big deal, but is an extra step I'd like to avoid.
- I'm writing this script for my team at work, most of us have multiple monitors all of varying resolution and sizes, in various configurations. In testing this, I'm currently running into an issue (Issue 2) where the palette pops up in the center of the primary monitor, and not the monitor where the photoshop window is (See attached screenshots). Is there a way to change this so the dialog appears on top of the photoshop window and not on some other monitor?
My code is as follows:
#target photoshop
var isDone, sTID, waitForRedraw, win, windowResource;
windowResource = "palette";
win = new Window(windowResource);
var oldInputGroup = win.add("group");
oldInputGroup.add("statictext", undefined, "Search for");
var oText = oldInputGroup.add("edittext", undefined, "Search for");
oText.characters = 25;
oText.active = true;
var newInputGroup = win.add("group");
newInputGroup.add("statictext", undefined, "Replace with");
var nText = newInputGroup.add("edittext", undefined, "Replace with");
nText.characters = 25;
nText.active = false;
var caseCheck = win.add("checkbox", undefined, "Case Sensitive?");
var bottomGroup = win.add("group");
var btnOK = bottomGroup.add("button", undefined, "OK");
var btnCancel = bottomGroup.add("button", undefined, "Cancel");
main();
In main I have:
isDone = false;
win.onClose = function(){
return isDone = true;
};
btnOK.onClick = function(){
dataEntry = getInfo();
return isDone = true;
};
btnCancel.onClick = function(){
return isDone = true;
};
win.show();
while (isDone === false) {
try{
app.refresh();
} catch(e){
isDone = true;
};
}
//getInfo collects data from the window
//then my script does its thing