how to switch between two application using pywinauto 0.5.4

拜拜、爱过 提交于 2019-12-07 07:20:29

This code should do the trick:

from pywinauto import application

app = application.Application()
app2 = application.Application()
app.start("Notepad.exe")
app2.start(r"C:\Program Files (x86)\eSpeak\eSpeakedit.exe")

# switch to Notepad
app.UntitledNotepad.SetFocus()
# select and copy next line (this is not the only way, just for example)
app.UntitledNotepad.Edit.TypeKeys('{DOWN}{HOME}+{END}^c')

 # switch to your app
app2.SpeakEditWindowTitle.SetFocus()
# paste somewhere
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!