Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Custom scripts dialogue window placement

Contributor ,
Dec 03, 2025 Dec 03, 2025

Is it possible to control, where the new dialogue window/alert of a custom script will appear on the screen when triggered? I have a new 4k monitor + 2nd smaller one. I use illustrator in the 4k monitor. All the alerts appear off-centered of the screen and the scripts that have a dialogue window open in the other monitor. 

Is there a way to control, where the new windows appear? Moving them by hand does not work or do anything.
I can somehow control it when changing the Main display option in windows 11 settings, but they still appear in random places on the screen. Added sample picture for reference. 

TOPICS
How-to , Scripting
238
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Dec 04, 2025 Dec 04, 2025

Hi @martink15467522 I think this might be a tricky problem because I don't think ScriptUI has a very sophisticated understanding of multiple monitors. One option is to just store the position that the user moves it to, and re-instate it next time. We can use Illustrators preferences for this. Here is a script showing this approach.

- Mark

 

/**
 * @file Store ScriptUI Window Location Example.js
 * 
 * (For Adobe Illustrator only.)
 * 
 * @author m1b
 * @version 2025-12-05
 */
(function () {

   
...
Translate
Adobe
Community Expert ,
Dec 04, 2025 Dec 04, 2025

Hi @martink15467522 I think this might be a tricky problem because I don't think ScriptUI has a very sophisticated understanding of multiple monitors. One option is to just store the position that the user moves it to, and re-instate it next time. We can use Illustrators preferences for this. Here is a script showing this approach.

- Mark

 

/**
 * @file Store ScriptUI Window Location Example.js
 * 
 * (For Adobe Illustrator only.)
 * 
 * @author m1b
 * @version 2025-12-05
 */
(function () {

    const DEFAULT_X = 200;
    const DEFAULT_Y = 200;
    const NO_PREFERENCE_VALUE = 1861879264;

    var w = new Window('dialog { text:"Window position example" }');
    var textGroup = w.add('Group { margins:[10,10,10,10] }');
    textGroup.add('StaticText { text:"The quick brown fox jumps over the lazy dog." }');

    var okayButton = w.add('Button { text: "Done", alignment:["right","top"], properties:{ name:"ok" } }');

    okayButton.onClick = function () {
        // store the window location in preferences
        app.preferences.setIntegerPreference('windowLocationLeft', w.location[0]);
        app.preferences.setIntegerPreference('windowLocationTop', w.location[1]);
        w.close(1);
    };

    // read the window location from preferences
    var windowX = app.preferences.getIntegerPreference('windowLocationLeft');
    var windowY = app.preferences.getIntegerPreference('windowLocationTop');

    if (NO_PREFERENCE_VALUE === windowX)
        windowX = DEFAULT_X;

    if (NO_PREFERENCE_VALUE === windowY)
        windowY = DEFAULT_Y;

    w.location = [windowX, windowY];

    var result = w.show();

    if (2 === result)
        // user cancelled
        return;

})();
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Dec 10, 2025 Dec 10, 2025
LATEST

Thanks! This works.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines