import os import uiautomation as auto import win32clipboard as clipboard import win32con def getCopy(): clipboard.OpenClipboard() res = clipboard.GetClipboardData(win32con.CF_UNICODETEXT) clipboard.CloseClipboard() window = auto.DocumentControl(searchDepth=3, Name='Text Area') window.SendKeys('{Ctrl}A') window.SendKeys('{Ctrl}C') return res res=getCopy() print(res)
https://www.zkxjob.com/49940 参考
https://github.com/mhammond/pywin32 这个py38自带的
https://github.com/yinkaisheng/Python-UIAutomation-for-Windows/ 需要将这里的包拷贝到py38/Lib/site-packages
这个工具自己网上搜下,用于获取窗口Name。
效果:成功读取
标签:读取,python,res,cmd,window,clipboard,https,import,com From: https://www.cnblogs.com/zhangzhekun/p/17044921.html