基本信息
源码名称:python 桌面应用程序自动化工具(pywinauto)
源码大小:0.50M
文件格式:.zip
开发语言:Python
更新时间:2019-01-16
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
桌面应用程序自动化工具
桌面应用程序自动化工具
"""
Uninstall script for 7zip 9.20 (64-bit)
Requirements:
- Win7 or Win8.1 x64, 64-bit Python
- pywinauto 0.5.2
- UAC is fully disabled
"""
from __future__ import print_function
import pywinauto
pywinauto.Application().Start(r'explorer.exe')
explorer = pywinauto.Application().Connect(path='explorer.exe')
# Go to "Control Panel -> Programs and Features"
NewWindow = explorer.window(top_level_only=True, active_only=True, class_name='CabinetWClass')
try:
NewWindow.AddressBandRoot.click_input()
NewWindow.type_keys(r'Control Panel\Programs\Programs and Features{ENTER}',
with_spaces=True, set_foreground=False)
ProgramsAndFeatures = explorer.window(top_level_only=True, active_only=True,
title='Programs and Features', class_name='CabinetWClass')
# wait while the list of programs is loading
explorer.wait_cpu_usage_lower(threshold=5)
item_7z = ProgramsAndFeatures.FolderView.get_item('7-Zip 9.20 (x64 edition)')
item_7z.ensure_visible()
item_7z.click_input(button='right', where='icon')
explorer.PopupMenu.menu_item('Uninstall').click()
Confirmation = explorer.window(title='Programs and Features', class_name='#32770', active_only=True)
if Confirmation.Exists():
Confirmation.Yes.click_input()
Confirmation.wait_not('visible')
WindowsInstaller = explorer.window(title='Windows Installer', class_name='#32770', active_only=True)
if WindowsInstaller.Exists():
WindowsInstaller.wait_not('visible', timeout=20)
SevenZipInstaller = explorer.window(title='7-Zip 9.20 (x64 edition)', class_name='#32770', active_only=True)
if SevenZipInstaller.Exists():
SevenZipInstaller.wait_not('visible', timeout=20)
if '7-Zip 9.20 (x64 edition)' not in ProgramsAndFeatures.FolderView.texts():
print('OK')
finally:
NewWindow.close()