Copy link to clipboard
Copied
Hi Experts, i wonder if i can connect keystrokes directly to functions instead of double click or (run) the script everytime with UI , i mean can i run script once and call the functions via keystrokes instead of showing Script UI that need to be Active to respond? and thanks in advance
#targetengine "mysession";
var w = new Window("palette", {independent:true});
w.orientation = "stack"
w.alignment = "center"
var edit = w.add ("edittext")
edit.visible = false
edit.active = true;
w.text = "Send KeyStrokes to Execute Functions"
w.preferredSize.width = 200;
w.alignChildren = ["left", "top"];
w.orientation = "row";
w.spacing = 5;
w.margins = 16
w.add ("statictext", undefined,"Send KeyStrokes to Execute Functions");
w.show();
w.addEventListener ("keydown", function keyPressed(key){
switch (key.keyName) {
case "U":
PressU();
case "V":
PressV();
case "H":
PressH();
case "M":
PressM();
case "Escape":
w.close()
}
})
If I understand you correctly, no, you can't. It looks as if you're simply trying to program your own keyboard shortcut handler. There's no need, InDesign has one. Store your functions as individual scripts and assign shortcut keys to them in InDesign's keyboard shortcuts editor.
Copy link to clipboard
Copied
If I understand you correctly, no, you can't. It looks as if you're simply trying to program your own keyboard shortcut handler. There's no need, InDesign has one. Store your functions as individual scripts and assign shortcut keys to them in InDesign's keyboard shortcuts editor.
Copy link to clipboard
Copied
@Peter Kahrel Thanks a lot, maybe this feature will be added in the future!