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

how to use "Esc" key to call a function in scripting

Community Beginner ,
Nov 01, 2012 Nov 01, 2012

Copy link to clipboard

Copied

I mean when I'm executing a script,if I want break a loop, I can just press the "Esc" key.I think this is very handly.But I also want to call a function when "Esc" is pressed,is this possible, and how can I do this?

TOPICS
Scripting

Views

703

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
Engaged ,
Nov 02, 2012 Nov 02, 2012

Copy link to clipboard

Copied

LATEST

Taken from Peter Kahrel's UI guide.

http://www.kahrel.plus.com/indesign/scriptui-2-0.pdf

So escape could be captured by if(myWindow.show()==2){do stuff }?

the user clicks OK (which in this script corresponds to pressing Enter) or they can click

Cancel (which is the equivalent of pressing Escape). The window's behaviour is

this: if the user presses OK, the line myWindow.show ( ) returns 1, if they press

Esc, that line returns 2. We capture this as follows:

if (myWindow.show () == 1)

var myName = myText.text;

else

exit ();

Votes

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