lunj Posted April 28, 2010 Share Posted April 28, 2010 Hi, I'm new to autoit. Developed a script to install/uninstall a program. It worked one day and stopped work the second day. Has anybody had this type of experience? My script is $sBase = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" $iEval = 1 $sSearch = "Fiery" While 1 $sUninst = "" $sDisplay = "" $sCurrent = RegEnumKey($sBase, $iEval) If @Error Then ExitLoop $sKey = $sBase & $sCurrent $sDisplay = RegRead($sKey, "DisplayName") If StringRegExp($sDisplay, "(?i).*" & $sSearch & ".*") Then $sUninst = RegRead($sKey, "UninstallString") If $sUninst Then Run($sUninst) WinwaitActive("Windows Installer") WinActive("Windows Installer") sleep(20) ControlClick("Windows Installer", "Are you sure you want to uninstall this product?", "Yes") EndIf EndIf $iEval += 1 WEnd It worked one day, but stopped working the second day. Anything wrong with it? Your help is greatly appreciated. Thanks Link to comment Share on other sites More sharing options...
Zedna Posted April 28, 2010 Share Posted April 28, 2010 1) You havent specified what is wrong "stop working" is not sufficient 2) You should add some logic for waiting after ControlClick until each app is uninstalled 3) Add to your script some debug ConsoleWrite() to see what's going on and where it hangs Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
lunj Posted April 28, 2010 Author Share Posted April 28, 2010 1) You havent specified what is wrong "stop working" is not sufficient2) You should add some logic for waiting after ControlClick until each app is uninstalled3) Add to your script some debug ConsoleWrite() to see what's going on and where it hangsSorry for not making it clear.1. "Stop working" here means the pop up window "Windows Installer" can not be closed.---ControlClick("Fiery®VUE - InstallShield Wizard", "", "Ok") didn't work.Thanks for the guidance! I was a perl developer. Now it's new to autoit. Link to comment Share on other sites More sharing options...
Fulano Posted April 28, 2010 Share Posted April 28, 2010 Also: please put your scripts in "autoit" tags, it makes it much easier to read.$sBase = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" $iEval = 1 $sSearch = "Fiery" While 1 $sUninst = "" $sDisplay = "" $sCurrent = RegEnumKey($sBase, $iEval) If @Error Then ExitLoop $sKey = $sBase & $sCurrent $sDisplay = RegRead($sKey, "DisplayName") If StringRegExp($sDisplay, "(?i).*" & $sSearch & ".*") Then $sUninst = RegRead($sKey, "UninstallString") If $sUninst Then Run($sUninst) WinwaitActive("Windows Installer") WinActive("Windows Installer") sleep(20) ControlClick("Windows Installer", "Are you sure you want to uninstall this product?", "Yes") EndIf EndIf $iEval += 1 WEnd #fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja! Link to comment Share on other sites More sharing options...
Zedna Posted April 28, 2010 Share Posted April 28, 2010 Also use Au3Info tool for getting exact window's/control's titles/texts Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now