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

Keydown to apply UI Dialog button

Guest
Jun 08, 2017 Jun 08, 2017

Copy link to clipboard

Copied

Hi all, hopefully someone will be able to help.

This is a snippet from a script I have used for a while but has now stopped working as I have stepped up to CC 2017 from CS6.

I used to be able to press 'l' to select the 'Lock' button, 'u' to select the 'Unlock' button but these no longer work.

I have looked for solutions but to no avail, can anyone let me know what has changed and how to fix the problem.

Thanks in advance, Bren

// UI Dialog options

win = new Window('dialog', 'PAGE HEADERS');

win.btn0 = win.add('button', undefined, 'LOCK \'L\'   ')

                win.btn0.onClick = function() {win.close(0)}

                win.addEventListener ( 'keydown', onKeyPress0 )

                function onKeyPress0 (evt) { if (evt.keyName=="H") { win.close(0) }}

win.btn1 = win.add('button', undefined, 'UNLOCK \'U\' ')

                win.btn1.onClick = function() {win.close(1)}

                win.addEventListener ( 'keydown', onKeyPress1 )

                function onKeyPress1 (evt) { if (evt.keyName=="U") { win.close(1) }}

              

win.btn2 = win.add('button', undefined, 'CANCEL \'Esc\'')

                win.cancelElement = win.btn2

win.center()

var myDlg = win.show()

TOPICS
Scripting

Views

453

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
Community Expert ,
Jun 08, 2017 Jun 08, 2017

Copy link to clipboard

Copied

Hi Bren,

just tested your script with InDesign CS6 v 8.1.0 and CC v 9.3.0 on Mac OS X 10.6.8.

InDesign CS6 v 8.1.0 : All is working as expected.

InDesign CC v 9.3.0 : No way. The event did not fire or the listener cannot listen.

I suspect a bug in CC and above.

Regards,
Uwe

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
Guest
Jun 09, 2017 Jun 09, 2017

Copy link to clipboard

Copied

Thanks Uwe, I will have to start moving and clicking the mouse again

I might report it on the 'Adobe Bug Report Form' but it may it be too small fry for them to worry about.

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
Community Expert ,
Jun 09, 2017 Jun 09, 2017

Copy link to clipboard

Copied

Hi Bren,

also did a little experiment where I included an edittext field that is active and not visible.

In this case the keyboard events can be detected.

That's no valid workaround, because this would only work as long as the invisible edittext field is active.

( It will not be active anymore if the user clicks in the gray area of the main ScriptUI window. )

All tests currently done on OS X 10.6.8.

Regards,
Uwe

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
Community Expert ,
Jun 09, 2017 Jun 09, 2017

Copy link to clipboard

Copied

Sorry.
I should have added, that I did this experiment (mis)using an edittext field with a "palette" type of window.
And not with a "dialog" one.

Regards,
Uwe

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
Community Expert ,
Jun 09, 2017 Jun 09, 2017

Copy link to clipboard

Copied

> I might report it on the 'Adobe Bug Report Form' but it may it be too small fry for them to worry about.

Do report it. It's not small fry. Any bug is a bug. If Adobe aren't told about these things, nothing happens. The more people complain the better.

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
Community Expert ,
Jun 09, 2017 Jun 09, 2017

Copy link to clipboard

Copied

LATEST

FWIW:

This issue is not only with "keydown", it's also with "keyup".


In the meanwhile I also tested with window type "window":

Same problems.


"panel" and "window" type ScriptUI windows in CC v 9.3.0 with an edittext field, visible or invisible:

If the listening mechanism stops it helps to switch to a different app and coming back to InDesign. As soon as the window gets focus and is active the listeners for "keydown" and "keyup" are working again. Event target is [object Edittext].

"palette" type ScriptUI windows in CC v 9.3.0 with an edittext field, visible or invisible:
If the listening mechanism stops I can get back access to the listening mechanism after clicking somewhere else out of the ScriptUI window and to click the title bar of the ScriptUI window. I do not have to switch to a different app. Event target is [object Edittext].

So having an edittext field somewhere in the window could be a "little workaround".

Regards,
Uwe

// EDITED

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
People's Champ ,
Jun 09, 2017 Jun 09, 2017

Copy link to clipboard

Copied

which I did with no more success. Ahhh ScriptUI

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