Highlighted

SctiptsUI Windows Immediately Close

Community Beginner ,
Oct 30, 2020

Copy link to clipboard

Copied

I've just started with learning how to create UI panels and windows. I've quickly run into a problem and would like some help.
Here is my script:

var palette = new Window("window"); 
    palette.text = "Dialog"; 
    palette.preferredSize.width = 277; 
    
palette.show();

When I run from VSCode, it shows fine. When I save it and run it in Illustrator (File>Scripts>Other Scripts) It looks like the window appears for a split second, then emmediately closes.

Most Valuable Participant
Correct answer by pixxxelschubser | Most Valuable Participant

Hi @billys9362937 

do you want a Palette or a Dialog?

 

example for Dialog

var dlg = new Window("dialog", 'Title Dialog');
dlg.preferredSize.width = 277; 
    
dlg.show();

 

example for Palette:

 

#targetengine main

var plt = new Window("palette", 'Title Palette');
plt.preferredSize.width = 277; 
    
plt.show();

 

 

If that works for you

have fun

😉

TOPICS
Scripting

Views

52

Likes

Translate

Translate

Report

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

SctiptsUI Windows Immediately Close

Community Beginner ,
Oct 30, 2020

Copy link to clipboard

Copied

I've just started with learning how to create UI panels and windows. I've quickly run into a problem and would like some help.
Here is my script:

var palette = new Window("window"); 
    palette.text = "Dialog"; 
    palette.preferredSize.width = 277; 
    
palette.show();

When I run from VSCode, it shows fine. When I save it and run it in Illustrator (File>Scripts>Other Scripts) It looks like the window appears for a split second, then emmediately closes.

Most Valuable Participant
Correct answer by pixxxelschubser | Most Valuable Participant

Hi @billys9362937 

do you want a Palette or a Dialog?

 

example for Dialog

var dlg = new Window("dialog", 'Title Dialog');
dlg.preferredSize.width = 277; 
    
dlg.show();

 

example for Palette:

 

#targetengine main

var plt = new Window("palette", 'Title Palette');
plt.preferredSize.width = 277; 
    
plt.show();

 

 

If that works for you

have fun

😉

TOPICS
Scripting

Views

53

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 30, 2020 0
Most Valuable Participant ,
Oct 30, 2020

Copy link to clipboard

Copied

Hi @billys9362937 

do you want a Palette or a Dialog?

 

example for Dialog

var dlg = new Window("dialog", 'Title Dialog');
dlg.preferredSize.width = 277; 
    
dlg.show();

 

example for Palette:

 

#targetengine main

var plt = new Window("palette", 'Title Palette');
plt.preferredSize.width = 277; 
    
plt.show();

 

 

If that works for you

have fun

😉

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 30, 2020 1
Community Beginner ,
Oct 30, 2020

Copy link to clipboard

Copied

Thanks for the reply!
I do see that I was using an argument that was not valid ("window")

When I use "dialog" as the first argument, it works.

When I use "palette" as the first argument, nothing appears.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 30, 2020 0
Most Valuable Participant ,
Oct 30, 2020

Copy link to clipboard

Copied

Have you added a targetengine for your Palette (see my example)?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 30, 2020 3
Community Beginner ,
Oct 30, 2020

Copy link to clipboard

Copied

Thank you so much!
 I guess I overlooked it in the above code block!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 30, 2020 0
Resources