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.

  1. 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.
  2. 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? Monitor 1 view Monitor 2 view

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");


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;

        while (isDone === false) {
            } catch(e){
                isDone = true;
    //getInfo collects data from the window
    //then my script does its thing

2 Answers 2


If my guess is correct, this has more to do with general OS stuff and/or Photoshop behavior, rather than just scriptui dialogs. I believe you got two options.

Option 1:

Make that second screen your main screen in mac System Preferences > Displays > Arrangement by dragging the white bar on one of the displays to the other one.

Option 2:

Turn on "Display have separate spaces" in mac System Preferences > Mission control > Displays have separate spaces checkbox.

I believe you already have that on, but when you have the application in the screen/space you want, right click the app icon in the dock and in Options below Assing to: choose Desktop on screen 2 or whichever screen it is. I'm pulling the wording from memory, but if that is not accurate, it's pretty self explanatory anyways once you see it.

I've noticed some weirdness with this myself, where window placement within the screen is kinda off. That's not a problem for most windows, like say PS preferences window, because you can just move them and next time you open that window, it opens up in the same location.

Unfortunately, scriptui dialogs don't retain last location (unless you enforce that perhaps?). I remember having this problem with dialogs that don't have a set location, so by default/normally they would be centered in the screen, but sometimes they just insist on hugging the right side of the screen every time I open a dialog. I'm not sure if setting a static location would help with that issue. But at the very least they will shop up in the secondary screen.

There's one more thing to consider. For some people this "Displays have separate spaces" setting is kind of a tradeoff. You get the menubar on each screen, separate backgrounds, fullscreen spaces are separate for each screen and you can solve window location issues like this, but just like the setting name implies, every screen has their own spaces. This isn't necessarily a big thing and can actually be pretty handy, but many are used to the default where all screens share the same space at all times.

If you want the other benefits of this setting but don't really care for the separate spaces, you can use TotalSpaces to sync them, essentially making sure every screen is on the same space number at all times. It has a checkbox in Preferences > Layout called Sync spaces, that is only visible when the "Displays have separate spaces" is on.

  • While I do have "Displays have separate spaces" turned on - I don't have separate spaces set up (effectively all 3 of my monitors are on 1 space). I'm confident that the majority of my team is in a similar boat for this (all monitors in one space), so I'm not sure the spaces suggestion will work for my team - since I would need to encourage them to set that up just for this script. I'll see if setting up a static location for the window will prevent it from showing up in a different monitor though. Worth a shot! Commented Nov 14, 2018 at 16:56
  • @RyanWalker, I don't see why it wouldn't work. You will always have at least one space. And with the setting on, you'll have at least as many spaces as you have screens. Also, if you fullscreen an app, that creates a temporary fullscreen space automatically. Though you are right. Since it is a OS lvl fix, everyone has to have it set up like that. We can only blame Apple or Adobe for that. It's not your script that is the issue. Whether or not you could fix the issue from the script... I have no idea.
    – Joonas
    Commented Nov 14, 2018 at 17:05
  • while setting a static location did not fix the monitor issue - switching the default monitor seems to have worked fine. It might be a bit of adjusting period for me, but at least it shows up in the expected spot now. Per Sergey's suggestion I also switched to dialog which should help the focus issue. I'm beginning to think that you're on to something when you say that there might just not be a way to fix this monitor issue from within the script. Commented Nov 14, 2018 at 17:34
  • @RyanWalker, there shouldn't be any reason why either of my suggestions wouldn't work. So I don't think you needed to change the primary display since you already had "displays have separate spaces" setting on. Those were 2 different solutions, not step 1 and step 2.
    – Joonas
    Commented Nov 14, 2018 at 17:40
  • 1
    @RyanWalker, maybe you already got the dialog done... But in case you didn't, I put my Scriptui Dialog Builder online today, if you want to check that out. It still has a few hiccups here and there...
    – Joonas
    Commented Nov 14, 2018 at 18:28
  1. Do you have any particular reason why you want to use a palette and not a dialog? I find palettes very unstable in Photoshop, but I guess you've read about this.

  2. As Joonas mentioned, by default scriptui windows don't retain position, but you can set win.location from win.onShow event and save location on panel close (win.onClose) for future use

  • This is my first ScriptUI project and I remember that there was a reason i chose palette and not dialog but I don't remember what that reason was. I will try to adjust my code to see if that helps solve issue (1) but... ...that makes issue 2 even more difficult. If the dialog opens on a different monitor, and you can't use the rest of the application, I can understand the rest of my team not knowing why their photoshop is frozen (if they can't find the dialog window, then effectively I've frozen their application). Commented Nov 14, 2018 at 16:45
  • dialog seems to have fixed the focus issue. Unfortunately updating the win.location property does not fix the monitor issue. However, this seems to be the ideal fix for now. Commented Nov 14, 2018 at 17:28
  • to help fixing the monitor issue with win.location you need to save coordinates every time user closes the window and then use these coordinates when windows reappears. This way the first time coordinates will be wrong, user will move window to a correct display, next time it'll be in the right place. Commented Nov 14, 2018 at 21:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.