Forum Discussion

Inok's avatar
Occasional Contributor
13 years ago

Best Practice checking if List Entry does not exist

I recorded a deinstalling procedure which basically works fine. I will use this for a clean up before installing and testing a setup, thus I deinstall a previous installation. But the first time, or if the user removed the application manually, the application does not exist and the test fails, but this should not result in an error.

What I am looking for is a solution eighter to ignore just some steps if they failed or use an “if then” path. Using the "if then" concept I ran into troubles that I don't get access to the installed application name. I only get access to the listbox of the Win7 Program Deinstall Dialog.

PS: I don’t want a global ignore of errors.

What is the recomended way to solve this?

1 Reply

  • Hi,

    If you're working with the list of installed programs in Windows, you just need to search it for the needed entry before trying to address it. For example:

    var list = Sys.Process("Explorer")./*lots of Explorer windows*/.Window("SysListView32", "FolderView");

    var found = false;

    for(var i = 0; i < list.wItemCount; i++)

    if(list.wItem(i) == "App name")


    found = true;





    // some actions with the "App name" item


    Also, there's a way to uninstall applications without dealing with GUI. There's an example in TC's How To here. The script posted there uses WMI to find and remove applications which is faster and more reliable than clicking in the 'Programs and Features' list.