执行外部应用程序并向其发送一些关键事件 [英] Execute external application and send some key events to it

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

问题描述

我找不到 Python 的解决方案.

I wasn't able to find a solution for Python.

我同意启动应用程序(使用 subprocess.Popen 或 subprocess.call),但我找不到其他方法:

I am abelt o launch the application (using subprocess.Popen or subprocess.call), but I can't find a way to do the other part:

我想向我刚刚打开的应用程序发送一系列密钥(一种宏).喜欢:

I want to send a serie of keys (kind of macro) to the application I just opened. Like:

标签标签进入标签标签删除...

Tab Tab Enter Tab Tab Delete ...

有没有办法做到这一点,Mac 和 PC 兼容?或者,如果不是,只有 PC?

Is there a way to do this that is Mac and PC compatible ? Or, in case not, only PC ?

感谢您的帮助,罗勒

附注.我知道有一些应用程序可以自动化一些按键事件,但我想自己制作.

PS. I know there are some application to automate some keys event, but I want to make my own.

推荐答案

在 windows 下你可以使用古老的 SendKeys 来做到这一点.有一些实现.一、使用win32 extensions 或两个,甚至还有几个现成的 模块 可用

Under windows you could use the venerable SendKeys to do this. There's a few implementations floating around. One, using the win32 extentions or two, there's even a couple ready-to-use modules available

这篇关于执行外部应用程序并向其发送一些关键事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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