1 Star 0 Fork 20

绝影/PythonUIAutomation4Windows

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
get_system_devices.py 957 Bytes
一键复制 编辑 原始数据 按行查看 历史
yinkaisheng 提交于 2016-10-19 16:56 . modify RunWithHotKey
#!python3
# -*- coding: utf-8 -*-
import time
import subprocess
import automation
def main():
subprocess.Popen('mmc.exe devmgmt.msc')
mmcWindow = automation.WindowControl(searchDepth = 1, ClassName = 'MMCMainFrame')
tree = automation.TreeControl(searchFromControl = mmcWindow)
for item, depth in automation.WalkTree(tree, getChildrenFunc = lambda c : c.GetChildren(), includeTop = True):
if isinstance(item, automation.TreeItemControl): #or item.ControlType == automation.ControlType.TreeItemControl
item.Select()
if automation.ExpandCollapseState.Collapsed == item.CurrentExpandCollapseState():
item.Expand(0)
automation.Logger.WriteLine(' ' * (depth - 1) * 4 + item.Name, automation.ConsoleColor.Green)
time.sleep(0.1)
if __name__ == '__main__':
main()
automation.GetConsoleWindow().SetActive()
input('\npress Enter to exit\n')
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/Zoffy/PythonUIAutomation4Windows.git
git@gitee.com:Zoffy/PythonUIAutomation4Windows.git
Zoffy
PythonUIAutomation4Windows
PythonUIAutomation4Windows
master

搜索帮助