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

ScriptUI.environment.keyboardState.keyName not working

Explorer ,
Mar 13, 2021 Mar 13, 2021

Copy link to clipboard

Copied

Hey,

For some reason, ScriptUI.environment.keyboardState.keyName is not working. Yesterday it worked just fine, but today it returns "undefined" for every key. Here is the code I'm using to test it:

var w = new Window("palette");
w.add("statictext", undefined, "detect key");

w.center();
w.show();

w.addEventListener('keydown', alertKey);

function alertKey(){
    var keyState = ScriptUI.environment.keyboardState;

    alert(keyState.keyName); // undefined
};

I'm using Windows, and other instances of that object (such as the .shiftKey, .ctrlKey and .altKey) work fine.

 

Thanks!

TOPICS
Scripting

Views

225

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
Advocate ,
Mar 13, 2021 Mar 13, 2021

Copy link to clipboard

Copied

Just gave a quick test on latest AE v18.0 and keyName seems to work just fine on OSx. It only returns undefined on shift/cmd/alt clicks, but works ok on any other key.

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
Explorer ,
Mar 14, 2021 Mar 14, 2021

Copy link to clipboard

Copied

LATEST

I don't know, for me keyName still returns undefined for every key. Do you think it has to do with the new AE update?

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