Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE

How can I Use SilkTest to remove programs in Windows XP?

How can I Use SilkTest to remove programs in Windows XP?

Silk Test is unable to fully interact with the windows Add/Remove programs dialog, however this action can be performed via accessing the registry and retrieving the relevant uninstall string command from the registry key and executing this via SilkTest.

Note: This is not production code and will need refined/tested and is only provided as an example. Once the uninstall process has been launched by SilkTest, there may be dialogs to navigate through in order to complete the process. This code does not account for any further actions after the uninstall process has been launched and therefore may require editing.

 addRemove

[ ] // Borland Code GShields
[ ] // Edited by: VOzohili
[ ] // Date: 26 June 2008
[ ] // Using SilkTest to uninstall programs via accessing the registry
[ ]
[ ] // Note: This is not production code and will need refined/tested and is only provided as an example. Once the uninstall process has
[ ] // been launched by SilkTest, there may be dialogs to navigate through in order to complete the process. This code does not account
[ ] // for any further actions after the uninstall process has been launched and therefore may require editing.
[ ]
[ ] // Required .dll (Packaged with SilkTest)
[ ] use "msw32.inc"
[ ]
[-] testcase AddRemoveApps () appstate none
[ ] // Var Declarations
[ ] // Get regvalue for reg entry:
[ ] // HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
[ ] INTEGER iKey = HKEY_LOCAL_MACHINE // defined in msw32.inc
[ ] STRING sPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
[ ] String sItem = ""
[ ]
[ ] Integer p, Counter = 0, listsize = 0
[ ] String sHolder = ""
[ ] List lRegkeys, lRegkeysunParsed
[ ] String sRegkey = "", sTemp = ""
[ ]
[ ] // PLEASE ENTER THE NAME OF THE PROGRAM YOU WANT TO UNINSTALL
[ ] // uses MatchStr function to compare input with registry keys
[ ] STRING sSearchString = "mozilla"
[ ]
[ ] // Get a list of all in the uninstall Key
[ ] lRegkeysunParsed = SYS_GetRegistryKeyNames (iKey, sPath)
[ ] // Convert to a string
[ ] integer n
[ ] // use MatchStr function to compare input with registry keys
[-] for n=1 to ListCount(lRegkeysunParsed)
[-] if(MatchStr("*" +sSearchString+ "*", lRegkeysunParsedNo))
[ ] print("Program to uninstall : " + lRegkeysunParsedNo)
[ ] sTemp = lRegkeysunParsedNo
[ ]
[-] if(sTemp == "")
[ ] LogError("There was no match found for entry : "" + sSearchString + """)
[-] else
[ ] sRegkey=sTemp
[ ]
[ ] // Set path - sPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"+sRegkey
[-] if(sRegkey == "")
[ ] print("Uninstall process discontinued......")
[-] else
[ ] sPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
[ ] sPath = sPath+"\"+sRegkey
[ ]
[ ] // Change item to retrieve uninstall string
[ ] sItem = "UninstallString"
[ ] String sUnInstallPath = ""
[ ]
[ ] //sUnInstallPath SYS_GetRegistryValue (iKey, sPath, sItem)
[ ] sUnInstallPath = SYS_GetRegistryValue (iKey, sPath, sItem)
[ ]
[ ] print(sRegkey + " uninstall path retrieved...")
[ ] //Execute the uninstall path command
[ ] SYS_Execute(sUnInstallPath)
[ ] print("Executed : " + sUnInstallPath)
[ ]
[ ] // Borland Code GShields
[ ] // Edited by: VOzohili

Information on how to return a list of all items in the Add/Remove programs list dialog can be found here

For older versions of SilkTest, please try using addRemove.t and for SilkTest 2008 and later, use addRemoveAppsUpdate.t


Related documents:

Old KB# 21008

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2013-02-15 19:15
Updated by:
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.