我是 PyWinAuto 的新手,我正在尝试在没有任何开发人员支持材料的情况下自动化应用程序。 如果我没有使用正确的词语来解释我的问题或者我问的是菜鸟问题,请道歉。
我需要能够在我的控件标识符中使用变量。
from pywinauto.application import Application
from pywinauto import Desktop
import time
'''
This script assumes that RMS is already open and logged into and is at the Home Screen
'''
#Connect to Open Application
app = Application(backend='uia').connect(title='RMS - Resident Management System (Patch: 0495) Highest Possible Classification is CUI', timeout=20)
app.RMSResidentManagementSystemPatchHighestPossibleClassificationisCUI.set_focus()
#THIS WORKS
app.RMSResidentManagementSystemPatchHighestPossibleClassificationisCUI.G5000358.click_input(button='left', double=True)
#I NEED SOMETHING LIKE THIS TO WORK
STRINGVARIABLE = 'G5000358'
app.RMSResidentManagementSystemPatchHighestPossibleClassificationisCUI.STRINGVARIABLE.click_input(button='left', double=True)
这就是我想要双击的东西。 如果有更好的方法,请告诉我。
| | | | | | Static - 'G5000358' (L487, T356, R627, B372)
| | | | | | ['Static20', 'G5000358', 'G5000358Static']
| | | | | | child_window(title="G5000358", auto_id="CellElement_0_0", control_type="Text")
我想通了(或者我偶然发现了一些似乎有效的东西)。
RMSDistNumb = 'G5000358'
app.RMSResidentManagementSystemPatchHighestPossibleClassificationisCUI.child_window(title=RMSDistNumb, control_type="Text").click_input(button='left', double=True)