Can I use Esc key to cancel a palette script

Explorer ,
Jun 22, 2022 Jun 22, 2022

Copy link to clipboard

Copied

Hi, 

I know it works with a "dialog", but I'm looking for a trick to use (Esc) key to exit a "palette".

 

I made a script palette that contains buttons of the most important scripts I use everyday. I can run different scripts smoothly.

 

The only thing that bothers me is the way to close it then open it and then close it again and so on. 

 

I tried to use it as a "dialog" instead of "palette" but the script buttons won't work unless the main "dialog" script is closed first. This means I will open and close the script for every button click.

 

Kindly help. 

TOPICS
How to , Scripting , Tools

Views

51

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
community guidelines

correct answers 1 Correct answer

Explorer , Jun 24, 2022 Jun 24, 2022
I found a workaround. i just created a hidden cancelElement button. ////////////////////Close Button var but = win.add("button", undefined, "Close"); but.size = [0,0]; win.cancelElement = but; but.onClick = function() { win.close(); } Works for me anyway.

Likes

Translate

Translate
Explorer ,
Jun 24, 2022 Jun 24, 2022

Copy link to clipboard

Copied

LATEST

I found a workaround. i just created a hidden cancelElement button.

////////////////////Close Button
var but = win.add("button", undefined, "Close");
but.size = [0,0];
win.cancelElement = but;
but.onClick = function() {
win.close();
}

 

Works for me anyway.

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
community guidelines