Python for Autohotkey style key-combination sniffing, automation?

前端 未结 2 582
萌比男神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 06:56

    You may want to look at AutoIt. It does everything that AutoHotKey can do, but the language syntax doesn't make you want to pull your hair out. Additonally, it has COM bindings so you can use most of it's abilities easily in python if you so desired. I've posted about how to do it here before.

    0 讨论(0)
  • 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()
    
    0 讨论(0)
提交回复
热议问题