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

ScriptUI.environment.keyboardState.keyName not working

Explorer ,
Mar 13, 2021 Mar 13, 2021

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
397
Translate
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

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.

Translate
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
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?

Translate
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