Automate a program removal under Vista or Windows 7
This script shows how to automate the dialog box Add/remove Programs under Vista or Windows 7.
You can find the corresponding script file under Script_Examples, sub-directory of scripts.
'Don't use Windows menu Start, but call directly Control Panel
'with the parameter for calling Add/Remove screen
Shell("control.exe"+" appwiz.cpl",1)
'Insert a synchronization on window Add/remove programs to be sure it has enough time to load.
'As the window is displayed before all the programs are listed within the window, a simple Synchronization on Window does not work.
''We wait until WinTask word is displayed within the list of Programs.
Pause 5 secs until
Text("WinTask")
InWindow("EXPLORER.EXE|SysListView32|FolderView",1)
PauseFalse
MsgBox("'Wait for' at line " + #ErrorLine$ + " has failed !")
End
EndPause
'Add a small pause to leave some time for the other programs to be displayed.
Pause 2
'Use ClickOnText WinTask function to click the Program name you want to remove.
UseWindow("EXPLORER.EXE|SysListView32|FolderView")
ClickOnText("WinTask",0,0,double,left)
pause 50 ticks
'Click Yes when the prompt for uninstalling is displayed
UseWindow("EXPLORER.EXE|CtrlNotifySink|Programs and Features|8",1)
Click(Button,"&Yes")
'Selected program uninstallation is launched - put here the uninstall process automation lines
'.....
'Close Add/remove programsCloseWindow("EXPLORER.EXE|CabinetWClass|Programs and Features",1)