向应用程序发送按键 [英] Sending a keypress to an application

查看:30
本文介绍了向应用程序发送按键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种简单的方法可以让应用程序认为用户按下了某个键?

Is there an easy way to make an application think the user has pressed a key?

这就是我尝试这样做的原因:

Here's why I am trying to do this:

我正在尝试追踪 Wine 应用程序中的回归.该错误似乎仅在用户按下特定键(在本例中为转义键)时才会出现.所以我想给 git bisect 一个启动应用程序的脚本,模拟按下转义,并告诉 git 如果程序崩溃,修订版是错误的.

I am trying to track down a regression in a Wine application. The bug only seems to show itself when the user presses a specific key (in this case, escape). So I wanted to give git bisect a script that launches the application, simulates pressing escape, and tells git that that the revision is bad if the program crashes.

推荐答案

使用 xdotool:http://www.semicomplete.com/projects/xdotool/

Use xdotool: http://www.semicomplete.com/projects/xdotool/

这篇关于向应用程序发送按键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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