Copy link to clipboard
Copied
Copy link to clipboard
Copied
Hi akiva_atwood,
what is the external app?
As far as I know "keydown" or "keyup" as event type can only be added successfully to event listeners with ScriptUI window elements like EditText in InDesign. See Marc Autret's answer in this thread:
Where is there a list of InDesign Event types?
Dick_Kain, Jan 05, 2017
https://community.adobe.com/t5/indesign/where-is-there-a-list-of-indesign-event-types/m-p/8851632
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
Hi Uwe
Streamdeck -- it's a remote conrols hardware device.
It can send text strings to any app.
(It can also communicate via HTTP -- but I haven't managed to get ID to work as a HTTP Server (I'm on a mac))
I want to write a monitor script that looks for certain text strings coming in (for example "CSBold" and then assigns the "Bold" character style)
This avoids needing to set up keyboard shortcuts in each doc
Copy link to clipboard
Copied
Apparently keydown events only work with dialog windows -- if I change my code to make it a palette it doesn't catch the event even if the palette has the focus...
Copy link to clipboard
Copied
Hi akiva_atwood,
I had mixed results with dialog type "palette" in CS6.
With InDesign 2020 and dialog type "window" I have to do some more tests.
It's working differently than with CS6.
All tests with the German version of InDesign on Windows 10.
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
Hi Uwe
Using the following code with diag=true the keydown events are caught.
When it's false they aren't
#targetengine "streamdeck";
var diag=false;
var w = diag ? new Window("dialog"):new Window("palette");
var edit = w.add("edittext");
edit.active = true;
edit.characters = 30;
var runButton = w.add('button {text: "test"}');
runButton.onClick = function () {
$.writeln("test");
}
$.writeln(1)
w.addEventListener("keydown", function (kd) { pressed(kd) });
edit.addEventListener("keydown", function (kd) { pressed(kd) });
$.writeln(2)
function pressed(k) {
$.writeln(k.keyName);
$.writeln(k.keyIdentifier);
$.writeln(k.shiftKey ? "Shift pressed" : "Shift not pressed");
$.writeln(k.altKey ? "Alt pressed" : "Alt not pressed");
$.writeln(k.ctrlKey ? "Ctrl pressed" : "Ctrl not pressed");
}
w.show();