Highlighted

Photoshop CS6 Mac: extendscript addEventListener keydown?

Participant ,
Aug 11, 2020

Copy link to clipboard

Copied

Hello,

 

Is there any way to link some keyboard shortcuts to a dialog window in Photoshop 13 (CS6) on Mac?

I mean a "direct" shortcut, like the ones for the Tool palette for example, and not a command-key shortcut (like the menus ones).

I tried this:

var w = new Window ("dialog");
var testText = w.add('statictext', [0,0,400,70], 'Press any key...\n\n(Escape to close this window.)', {multiline: true, justify: "left"});
w.addEventListener ("keydown", function (kd) {pressed (kd)}); // or false ?

function pressed (k) {
testText.text = k.keyName + '---' + k.keyIdentifier;
//alert(k.keyName + '---' + k.keyIdentifier);
}

w.show();

 

But when I hit a key, I only have a beep. It seems the modal dialog doesn't allow any action.

I also tried to listen a button instead a the whole window, like this:

var w = new Window ("dialog");
var testText = w.add('statictext', [0,0,400,70], 'Press any key...\n\n(Escape to close this window.)', {multiline: true, justify: "left"});
var testBtn = w.add("button", undefined, "T", {name: "test"});
testBtn.addEventListener ("keydown", function (kd) {pressed (kd)}); // or false ?

function pressed (k) {
testText.text = k.keyName + '---' + k.keyIdentifier;
//alert(k.keyName + '---' + k.keyIdentifier);
}

w.show();

 

If I hit a key as soon as the window is shown, I only have beep. But if I first click the defined button, staticText is updated when I hit a key (but I also have beeps).

 

I suppose the problem is due to the "dialog" window: maybe It will work fine with a "palette" window, but palettes are not working on Mac.

 

Thank you for your help.

Topics

How to, Mac

Views

33

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

Photoshop CS6 Mac: extendscript addEventListener keydown?

Participant ,
Aug 11, 2020

Copy link to clipboard

Copied

Hello,

 

Is there any way to link some keyboard shortcuts to a dialog window in Photoshop 13 (CS6) on Mac?

I mean a "direct" shortcut, like the ones for the Tool palette for example, and not a command-key shortcut (like the menus ones).

I tried this:

var w = new Window ("dialog");
var testText = w.add('statictext', [0,0,400,70], 'Press any key...\n\n(Escape to close this window.)', {multiline: true, justify: "left"});
w.addEventListener ("keydown", function (kd) {pressed (kd)}); // or false ?

function pressed (k) {
testText.text = k.keyName + '---' + k.keyIdentifier;
//alert(k.keyName + '---' + k.keyIdentifier);
}

w.show();

 

But when I hit a key, I only have a beep. It seems the modal dialog doesn't allow any action.

I also tried to listen a button instead a the whole window, like this:

var w = new Window ("dialog");
var testText = w.add('statictext', [0,0,400,70], 'Press any key...\n\n(Escape to close this window.)', {multiline: true, justify: "left"});
var testBtn = w.add("button", undefined, "T", {name: "test"});
testBtn.addEventListener ("keydown", function (kd) {pressed (kd)}); // or false ?

function pressed (k) {
testText.text = k.keyName + '---' + k.keyIdentifier;
//alert(k.keyName + '---' + k.keyIdentifier);
}

w.show();

 

If I hit a key as soon as the window is shown, I only have beep. But if I first click the defined button, staticText is updated when I hit a key (but I also have beeps).

 

I suppose the problem is due to the "dialog" window: maybe It will work fine with a "palette" window, but palettes are not working on Mac.

 

Thank you for your help.

Topics

How to, Mac

Views

34

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

Have something to add?

Join the conversation