如何在ExtendScript中模拟按键? [英] How to simulate a key-press in ExtendScript?

查看:126
本文介绍了如何在ExtendScript中模拟按键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,我想为AE写一个脚本,这使我省去了一些键盘输入。
脚本运行后,我想用鼠标单击,然后应模拟一些按键输入,例如X Y和Z。小小的GUI和事件处理程序都没有问题,但是只是按键的模拟。

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


推荐答案

Extendscript中有一些东西看起来可以执行键盘事件

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

JavaScript工具指南查看第152页

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

这篇关于如何在ExtendScript中模拟按键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆