Jump to content

Recommended Posts

Posted

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

Posted

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

Sorry 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. :idea:

Posted

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!

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...