使用python发送按键组合 [英] Send key combination with python

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

问题描述

我希望能够发送组合键 SHIFT + CTRL +. (点),使用以下代码:

I want to be able to send the key combination SHIFT + CTRL + . (dot) using the following code:

import win32com.client as comclt
wsh= comclt.Dispatch("WScript.Shell")
wsh.SendKeys() 

到目前为止,我已经能够发送 CTRL +. (点):

So far I was able to send CTRL + . (dot) like this :

wsh.SendKeys(^.) 

如何在其中添加SHIFT键?

How do I add the SHIFT key there ?

感谢任何回答:)

推荐答案

对于Shift,请使用+

For Shift use +

完整列表在此处可用: SendKeys

Complete list is available here: SendKeys

...要指定在按下其他几个键的同时按住SHIFT,CTRL和ALT的组合,请创建一个复合字符串参数,并在括号内包含修改后的击键.例如,要发送指定在以下情况下按住SHIFT键的击键组合:

... To specify that a combination of SHIFT, CTRL, and ALT should be held down while several other keys are pressed, create a compound string argument with the modified keystrokes enclosed in parentheses. For example, to send the keystroke combination that specifies that the SHIFT key is held down while:

  • e和c被按下,发送字符串参数"+(ec)".
  • 按下
  • e,然后按一个孤立的c(不带SHIFT),发送字符串参数"+ ec". ...

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

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