Python for Autohotkey style key-combination sniffing, automation?

前端 未结 2 597
萌比男神i
萌比男神i 2021-01-31 06:14

I want to automate several tasks (eg. simulate eclipse style ctrl-shift-R open dialog for other editors). The general pattern is: the user will

2条回答
  •  無奈伤痛
    2021-01-31 07:06

    Found the answer using pyHook and the win32 extensions:

    import pyHook
    import pythoncom
    
    def OnKeyboardEvent(event):
        print event.Ascii
    
    hm = pyHook.HookManager()
    hm.KeyDown = OnKeyboardEvent
    hm.HookKeyboard()
    
    while True:
        pythoncom.PumpMessages()
    

提交回复
热议问题