简体   繁体   中英

How to simulate a key-press in ExtendScript?

currently I want to write a script for AE, which relieves me of some keyboard inputs. Once the script is running, I want to click with the mouse, and then some key-inputs for example XY and Z should be simulated. The little GUI and the eventhandler are no problems, but the simulation of key pressing. Please help.

var win = new Window ("dialog", "Dummy");
win.aButton = win.add ("button", undefined, "Start");
win.bButton = win.add ("button", undefined, "Stop");

//Start
win.aButton.onClick = function (event){
var activeViewer = app.activeViewer;
    if activeViewer.type == ViewerType.VIEWER_COMPOSITION){

     HERE SHOULD THE KEYS x, y AND z PRESSED VIA THE SCRIPT 

    }else return;
}
//Stop
win.bButton.onClick = function (event){
    win.close();
    return;
}
win.show();

There is something in Extendscript that looks like it can execute KeyboardEvents

Javascript Tools Guide Look at page 152

initKeyboardEvent() eventObj.initKeyboardEvent (eventName, bubble, isCancelable, view, keyID, keyLocation, modifiersList)  

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM