python
from pywinauto import Application
app = Application("uia").connect(path="explorer")
app["任务栏"].print_control_identifiers()
task = app["任务栏"].child_window(title="酷狗音乐", auto_id="D:\soft\kugou\KGMusic\KuGou.exe", control_type="Button").click()
Pane - '任务栏' (L0, T1030, R1920, B1080)
['Pane', '任务栏', '任务栏Pane', 'Pane0', 'Pane1']
child_window(title="任务栏", control_type="Pane")
|
| Button - '开始' (L0, T1030, R60, B1080)
| ['Button', '开始', '开始Button', 'Button0', 'Button1']
| child_window(title="开始", control_type="Button")
|
| Pane - '' (L60, T1030, R420, B1080)
| ['Pane2']
| child_window(auto_id="4100", control_type="Pane")
| |
| | Button - '搜索突出显示图标打开搜索主页窗口' (L320, T1030, R420, B1080)
| | ['Button2', '搜索突出显示图标打开搜索主页窗口Button', '搜索突出显示图标打开搜索主页窗口']
| | child_window(title="搜索突出显示图标打开搜索主页窗口", auto_id="4104", control_type="Button")
| |
| | Button - '搜索' (L60, T1030, R420, B1080)
| | ['Button3', '搜索Button', '搜索']
| | child_window(title="搜索", auto_id="4101", control_type="Button")
|
| Button - '任务视图' (L420, T1030, R480, B1080)
| ['Button4', '任务视图', '任务视图Button']
| child_window(title="任务视图", auto_id="4113", control_type="Button")
|
| Toolbar - '运行中的应用程序' (L480, T1030, R1262, B1080)
| ['Toolbar', '运行中的应用程序', '运行中的应用程序Toolbar', 'Toolbar0', 'Toolbar1']
| child_window(title="运行中的应用程序", control_type="ToolBar")
| |
| | Button - 'Google Chrome' (L484, T1030, R546, B1080)
| | ['Button5', 'Google ChromeButton', 'Google Chrome']
| | child_window(title="Google Chrome", auto_id="Chrome.7A7FDNLGMGRKEPWKDXRTQODC6M", control_type="Button")
| |
| | Button - 'Microsoft Edge - 1 个运行窗口' (L546, T1030, R608, B1080)
| | ['Button6', 'Microsoft Edge - 1 个运行窗口', 'Microsoft Edge - 1 个运行窗口Button']
| | child_window(title="Microsoft Edge - 1 个运行窗口", auto_id="MSEdge", control_type="Button")
| |
| | Button - '邮件' (L608, T1030, R670, B1080)
| | ['Button7', '邮件', '邮件Button']
| | child_window(title="邮件", auto_id="microsoft.windowscommunicationsapps_8wekyb3d8bbwe!microsoft.windowslive.mail", control_type="Button")
| |
| | Button - '文件资源管理器 - 1 个运行窗口' (L670, T1030, R732, B1080)
| | ['Button8', '文件资源管理器 - 1 个运行窗口', '文件资源管理器 - 1 个运行窗口Button']
| | child_window(title="文件资源管理器 - 1 个运行窗口", auto_id="Microsoft.Windows.Explorer", control_type="Button")
| |
| | Button - '酷狗音乐' (L732, T1030, R794, B1080)
| | ['Button9', '酷狗音乐', '酷狗音乐Button']
| | child_window(title="酷狗音乐", auto_id="D:\soft\kugou\KGMusic\KuGou.exe", control_type="Button")
| |
| | Button - '微信 - 1 个运行窗口' (L794, T1030, R856, B1080)
| | ['Button10', '微信 - 1 个运行窗口', '微信 - 1 个运行窗口Button']
| | child_window(title="微信 - 1 个运行窗口", auto_id="{7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}\Tencent\WeChat\WeChat.exe", control_type="Button")
| |
| | MenuItem - '哔哩哔哩 - 2 个运行窗口' (L856, T1030, R918, B1080)
| | ['MenuItem', '哔哩哔哩 - 2 个运行窗口', '哔哩哔哩 - 2 个运行窗口MenuItem']
| | child_window(title="哔哩哔哩 - 2 个运行窗口", auto_id="BiliBiliPC", control_type="MenuItem")
| |
| | Button - 'PyCharm Community Edition 2023.1.4 - 1 个运行窗口' (L918, T1030, R980, B1080)
| | ['Button11', 'PyCharm Community Edition 2023.1.4 - 1 个运行窗口', 'PyCharm Community Edition 2023.1.4 - 1 个运行窗口Button']
| | child_window(title="PyCharm Community Edition 2023.1.4 - 1 个运行窗口", auto_id="D:\soft\pycharm\PyCharm Community Edition 2023.1.4\bin\pycharm64.exe", control_type="Button")
| |
| | Button - 'ViewWizard - 1 个运行窗口' (L980, T1030, R1042, B1080)
| | ['Button12', 'ViewWizard - 1 个运行窗口', 'ViewWizard - 1 个运行窗口Button']
| | child_window(title="ViewWizard - 1 个运行窗口", auto_id="D:\soft\viewwizard\ViewWizard.exe", control_type="Button")
|
| Pane - 'HPSA_TASKBAR' (L1268, T1035, R1308, B1075)
| ['Pane3', 'HPSA_TASKBARPane', 'HPSA_TASKBAR']
| child_window(title="HPSA_TASKBAR", control_type="Pane")
|
| Button - '气温下降' (L1416, T1030, R1558, B1080)
| ['Button13', '气温下降', '气温下降Button']
| child_window(title="气温下降", auto_id="4105", control_type="Button")
|
| Pane - '' (L1568, T1030, R1920, B1080)
| ['Pane4']
| child_window(auto_id="303", control_type="Pane")
| |
| | Button - '通知 V 形' (L1568, T1030, R1598, B1080)
| | ['Button14', '通知 V 形', '通知 V 形Button']
| | child_window(title="通知 V 形", auto_id="1502", control_type="Button")
| |
| | Pane - '' (L1598, T1030, R1688, B1080)
| | ['Pane5']
| | |
| | | Toolbar - '用户提示通知区域' (L1598, T1030, R1688, B1080)
| | | ['Toolbar2', '用户提示通知区域Toolbar', '用户提示通知区域']
| | | child_window(title="用户提示通知区域", auto_id="1504", control_type="ToolBar")
| | | |
| | | | Button - '96% 可用(已接通电源)' (L1598, T1030, R1628, B1080)
| | | | ['Button15', '96% 可用(已接通电源)', '96% 可用(已接通电源)Button']
| | | | child_window(title="96% 可用(已接通电源)", auto_id="{7820AE75-23E3-4229-82C1-E41CB67D5B9C}", control_type="Button")
| | | |
| | | | Button - '419欢乐多\nInternet 访问\n\n本地连接 2\n无法连接到 Internet' (L1628, T1030, R1658, B1080)
| | | | ['Button16', '419欢乐多\nInternet 访问\n\n本地连接 2\n无法连接到 InternetButton', '419欢乐多\nInternet 访问\n\n本地连接 2\n无法连接到 Internet']
| | | | child_window(title="419欢乐多\nInternet 访问\n\n本地连接 2\n无法连接到 Internet", auto_id="{7820AE74-23E3-4229-82C1-E41CB67D5B9C}", control_type="Button")
| | | |
| | | | Button - '耳机: 36%' (L1658, T1030, R1688, B1080)
| | | | ['Button17', '耳机: 36%Button', '耳机: 36%']
| | | | child_window(title="耳机: 36%", auto_id="{7820AE73-23E3-4229-82C1-E41CB67D5B9C}", control_type="Button")
| |
| | Pane - '任务栏输入指示' (L1688, T1030, R1761, B1080)
| | ['任务栏输入指示', 'Pane6', '任务栏输入指示Pane']
| | child_window(title="任务栏输入指示", auto_id="308", control_type="Pane")
| | |
| | | Button - '输入法模式图标 - 英语模式\n\n单击右键以查看更多选项' (L1688, T1030, R1716, B1080)
| | | ['Button18', '输入法模式图标 - 英语模式\n\n单击右键以查看更多选项Button', '输入法模式图标 - 英语模式\n\n单击右键以查看更多选项']
| | | child_window(title="输入法模式图标 - 英语模式\n\n单击右键以查看更多选项", control_type="Button")
| | |
| | | Button - '任务栏输入指示 - 中文(简体,中国)' (L1716, T1030, R1761, B1080)
| | | ['Button19', '任务栏输入指示 - 中文(简体,中国)', '任务栏输入指示 - 中文(简体,中国)Button']
| | | child_window(title="任务栏输入指示 - 中文(简体,中国)", control_type="Button")
| |
| | Button - '系统时钟, 16:11, 2024/4/16' (L1761, T1030, R1854, B1080)
| | ['Button20', '系统时钟, 16:11, \u200e2024/\u200e4/\u200e16Button', '系统时钟, 16:11, \u200e2024/\u200e4/\u200e16']
| | child_window(title="系统时钟, 16:11, 2024/4/16", control_type="Button")
| |
| | Button - '操作中心,1 个新通知' (L1854, T1030, R1914, B1080)
| | ['Button21', '操作中心,1 个新通知Button', '操作中心,1 个新通知']
| | child_window(title="操作中心,1 个新通知", control_type="Button")
| |
| | Button - '显示桌面' (L1914, T1030, R1920, B1080)
| | ['Button22', '显示桌面', '显示桌面Button']
| | child_window(title="显示桌面", auto_id="307", control_type="Button")