How to send simulated keyboard strokes to the active window using SendKeys

前端 未结 2 813
误落风尘
误落风尘 2021-01-06 12:49

I am new to Python and am trying to send a combination of key strokes to an application I open under Windows 7. While my script will work flawlessly when I invoke Notepad.ex

相关标签:
2条回答
  • 2021-01-06 12:59

    I know this was asked 6 years ago, but someone might be with the same problem, so here is a possible solution:

    shell.AppActivate('Put_The_Name_Here')

    The code above will select the program, file, etc that is opened but not activated, that, maybe, is your problem.

    Hope this helps someone!

    0 讨论(0)
  • 2021-01-06 13:24

    OK ... I rebooted the system and for some reason it is working now. I am wondering if some process instance from previous programme invocations might have been lingering on the system. Anyway, I am now able to perform the manipulations as expected, even if I don't really understand what went wrong in the first place.

    Thanks to everyone who took the time to repsond.

    0 讨论(0)
提交回复
热议问题