Jump to content
Sign in to follow this  
redfive19

WinActive not working or something

Recommended Posts

Guys,

This is my first post here. I've searched and couldn't find a suitable answer to this question. I am trying to uninstall an HP printer. Half-way through the install, it prompts to remove shared files to which I would like to answer "Yes To All." Problem is, this doesn't happen everytime so I created an IF statement

run("C:\Program Files\Hewlett-Packard\LaserJet 33xx\Uninstall\Setup.exe uninst.ini")
WinWaitActive("Welcome", "&Next >")
ControlClick("Welcome", "&Next >", "Button1")
$YESTOALL = WinActive("Uninstall Wizard", "File Name:")
If $YESTOALL = 1 Then
    Send("!E")
    WinWaitActive("Uninstall Wizard Complete", "&Finish")
    ControlClick("Uninstall Wizard Complete", "&Finish", "Button1")
    WinWaitActive("Uninstall Wizard", "No, I will restart my computer later.")
    ControlClick("Uninstall Wizard", "No, I will restart my computer later.", "Button3")
    ControlClick("Uninstall Wizard", "No, I will restart my computer later.", "Button5")
Else
    WinWaitActive("Uninstall Wizard Complete", "&Finish")
    ControlClick("Uninstall Wizard Complete", "&Finish", "Button1")
    WinWaitActive("Uninstall Wizard", "No, I will restart my computer later.")
    ControlClick("Uninstall Wizard", "No, I will restart my computer later.", "Button3")
    ControlClick("Uninstall Wizard", "No, I will restart my computer later.", "Button5")
    Exit
EndIf


Exit

I've also tried it like this:

run("C:\Program Files\Hewlett-Packard\LaserJet 33xx\Uninstall\Setup.exe uninst.ini")
WinWaitActive("Welcome", "&Next >")
ControlClick("Welcome", "&Next >", "Button1")
If WinActive("Uninstall Wizard", "File Name:") Then
    Send("!E")
    WinWaitActive("Uninstall Wizard Complete", "&Finish")
    ControlClick("Uninstall Wizard Complete", "&Finish", "Button1")
    WinWaitActive("Uninstall Wizard", "No, I will restart my computer later.")
    ControlClick("Uninstall Wizard", "No, I will restart my computer later.", "Button3")
    ControlClick("Uninstall Wizard", "No, I will restart my computer later.", "Button5")
Else
    WinWaitActive("Uninstall Wizard Complete", "&Finish")
    ControlClick("Uninstall Wizard Complete", "&Finish", "Button1")
    WinWaitActive("Uninstall Wizard", "No, I will restart my computer later.")
    ControlClick("Uninstall Wizard", "No, I will restart my computer later.", "Button3")
    ControlClick("Uninstall Wizard", "No, I will restart my computer later.", "Button5")
    Exit
EndIf


Exit

Now if I state that that window WILL show, it works just fine!!!

Run("C:\Program Files\Hewlett-Packard\LaserJet 33xx\Uninstall\Setup.exe uninst.ini")
        WinWaitActive("Welcome", "&Next >")
        ControlClick("Welcome", "&Next >", "Button1")
        WinWaitActive("Uninstall Wizard", "File Name:")
        Send("!E") 
        WinWaitActive("Uninstall Wizard Complete", "&Finish")
        ControlClick("Uninstall Wizard Complete", "&Finish", "Button1")
        WinWaitActive("Uninstall Wizard", "No, I will restart my computer later.")
        ControlClick("Uninstall Wizard", "No, I will restart my computer later.", "Button3")
        ControlClick("Uninstall Wizard", "No, I will restart my computer later.", "Button5")

I am still a complete noob on this app but I am quickly learning the ropes. Can someone tell me what I am doing all wrong?

thanks in advance...

-redfive

Share this post


Link to post
Share on other sites

Your not giving enough time for window "Uninstall Wizard", "File Name:" to show

Try this:

run("C:\Program Files\Hewlett-Packard\LaserJet 33xx\Uninstall\Setup.exe uninst.ini")
WinWaitActive("Welcome", "&Next >")
ControlClick("Welcome", "&Next >", "Button1")
WinWaitActive("Uninstall Wizard", "File Name:",5);Give time for window to show
If WinActive("Uninstall Wizard", "File Name:") Then
    Send("!E")
    WinWaitActive("Uninstall Wizard Complete", "&Finish")
    ControlClick("Uninstall Wizard Complete", "&Finish", "Button1")
    WinWaitActive("Uninstall Wizard", "No, I will restart my computer later.")
    ControlClick("Uninstall Wizard", "No, I will restart my computer later.", "Button3")
    ControlClick("Uninstall Wizard", "No, I will restart my computer later.", "Button5")
Else
    WinWaitActive("Uninstall Wizard Complete", "&Finish")
    ControlClick("Uninstall Wizard Complete", "&Finish", "Button1")
    WinWaitActive("Uninstall Wizard", "No, I will restart my computer later.")
    ControlClick("Uninstall Wizard", "No, I will restart my computer later.", "Button3")
    ControlClick("Uninstall Wizard", "No, I will restart my computer later.", "Button5")
    Exit
EndIf
Edited by bshoenhair

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...