Has anyone ported "pywinauto/examples/uninstall_7zip.py" example to windows 10? I tried to run it, but it fails:
NewWindow.type_keys(r'Control Panel\Programs\Programs and Features{ENTER}', with_spaces=True,
set_foreground=False) (Fails in this line)
I modified to reach the control panel uninstall window, further nor able to get / select the 7-Zip program. Below is the code snippet to reach uninstall window:
Application().start('control.exe')
app = Application(backend='uia').connect(path='explorer.exe', title='Control Panel')
# Go to "Programs"
app.window(title='Control Panel').ProgramsHyperlink.invoke()
app.wait_cpu_usage_lower(threshold=0.5, timeout=30, usage_interval=1.0)
# Go to "Uninstall a program"
app.window(title='Programs').child_window(title='Uninstall a program',
control_type='Hyperlink').invoke()
app.wait_cpu_usage_lower(threshold=0.5, timeout=30, usage_interval=1.0)
Updated program to uninstall 7-zip program from control panel -
from pywinauto.application import Application
from pywinauto import Desktop
import time
Application().start('control.exe')
app = Application(backend='uia').connect(path='explorer.exe', title='Control
Panel')
# Go to "Programs"
app.window(title='Control Panel').ProgramsHyperlink.invoke()
app.wait_cpu_usage_lower(threshold=0.5, timeout=30, usage_interval=1.0)
# Go to "Uninstall a program"
app.window(title='Programs').child_window(title='Uninstall a program',
control_type='Hyperlink').invoke()
app.wait_cpu_usage_lower(threshold=0.5, timeout=30, usage_interval=1.0)
NewWindow = app.window(top_level_only=True, active_only=True,
class_name='CabinetWClass')
NewWindow.type_keys(r'7-Zip{ENTER}', with_spaces=True, set_foreground=False)
time.sleep(10)
After this I'm unable to figure out how to transfer control to the resulting window, and click the 'Next' button.
so mixed pyautogui commands, as the uninstall windows is active, it's receiving the keyboard key press
pyautogui.press('enter') => repeat this 3 times to click Next on all windows