如何在ExtendScript中模拟按键?

时间:2014-11-10 18:42:29

标签: javascript adobe extendscript after-effects

目前我想为AE编写一个脚本,它让我省去了一些键盘输入。 一旦脚本运行,我想用鼠标点击,然后应该模拟一些键输入,例如X Y和Z.小GUI和事件处理程序都没有问题,但按键模拟。请帮忙。

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();

1 个答案:

答案 0 :(得分:2)

Extendscript中有一些东西看起来像是可以执行KeyboardEvents

Javascript Tools Guide请参阅第152页

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