Sign in to follow this  
Followers 0
CGSEdm

Select WinWaitActive

5 posts in this topic

I'm trying to remove Symantec Antivirus across my network, and I've got my script nearly completed.

Depending on whether Symantec was removed using MSI or not, the last dialog box could be different.

I thought this should work, but it doesn't...

Select
    Case WinWaitActive("CleanWipe", "CleanWipe has completed.") = 1
        Send("{Enter}")
        SplashOff()
        BlockInput(0)
        MsgBox(4144, "Symantec removed, no restart necessary.", "Symantec has been removed." & @CRLF & @CRLF & "No restart is necessary." & @CRLF & @CRLF & "Click OK to continue." & @CRLF & @CRLF & "Control of your mouse and keyboard has been returned to you.")
    Case WinWaitActive("Restart Computer", "CleanWipe is going to accomplish") = 1
        Send("{Enter}")
        SplashTextOn("Restarting", "Restarting your computer, please standby.", -1, 45, -1, -1, 1, "Tahoma", 14)
EndSelect

These dialog boxes come after a bunch of programs and scripts run, so I can't reliably put a timeout and If...Then...EndIf on the WinWaitActive.

Any ideas how I can do this?

Share this post


Link to post
Share on other sites



While 1
    Select
        Case WinActive("CleanWipe", "CleanWipe has completed.") = 1
            Send("{Enter}")
            SplashOff()
            BlockInput(0)
            MsgBox(4144, "Symantec removed, no restart necessary.", "Symantec has been removed." & @CRLF & @CRLF & "No restart is necessary." & @CRLF & @CRLF & "Click OK to continue." & @CRLF & @CRLF & "Control of your mouse and keyboard has been returned to you.")
            ExitLoop
        Case WinActive("Restart Computer", "CleanWipe is going to accomplish") = 1
            Send("{Enter}")
            SplashTextOn("Restarting", "Restarting your computer, please standby.", -1, 45, -1, -1, 1, "Tahoma", 14)
            ExitLoop
    EndSelect
WEnd

Is this what you are looking for?

Mat

Share this post


Link to post
Share on other sites

First, thanks for doing the planet a service by uninstalling Symantec products

Try a Do/until loop to wait until either of those windows exist

Do
    sleep(250)
Until WinExists("CleanWipe", "CleanWipe has completed.")=1 or WinExists(("Restart Computer", "CleanWipe is going to accomplish")=1

Select
    Case WinActive("CleanWipe", "CleanWipe has completed.") = 1
        Send("{Enter}")
        SplashOff()
        BlockInput(0)
        MsgBox(4144, "Symantec removed, no restart necessary.", "Symantec has been removed." & @CRLF & @CRLF & "No restart is necessary." & @CRLF & @CRLF & "Click OK to continue." & @CRLF & @CRLF & "Control of your mouse and keyboard has been returned to you.")
    Case WinActive("Restart Computer", "CleanWipe is going to accomplish") = 1
        Send("{Enter}")
        SplashTextOn("Restarting", "Restarting your computer, please standby.", -1, 45, -1, -1, 1, "Tahoma", 14)
EndSelect

Alternatively something like this:

While 1
    Select
        Case WinActive("CleanWipe", "CleanWipe has completed.") = 1
            Send("{Enter}")
            SplashOff()
            BlockInput(0)
            MsgBox(4144, "Symantec removed, no restart necessary.", "Symantec has been removed." & @CRLF & @CRLF & "No restart is necessary." & @CRLF & @CRLF & "Click OK to continue." & @CRLF & @CRLF & "Control of your mouse and keyboard has been returned to you.")
            ExitLoop(2)
        Case WinActive("Restart Computer", "CleanWipe is going to accomplish") = 1
            Send("{Enter}")
            SplashTextOn("Restarting", "Restarting your computer, please standby.", -1, 45, -1, -1, 1, "Tahoma", 14)
            Exitloop(2)
    EndSelect   
    sleep(250)  
WEnd

Share this post


Link to post
Share on other sites

Right on!

Thanks to both of you! It's working now!

I've decided to go with the Do Until loop.

This is a very active forum! One of the main reasons that I'm working to switch all of my scripts over from KiXtart. ..and it's pretty cool that I can run any setup program without having to figure out the command line switches.

Cheers!

Share this post


Link to post
Share on other sites

But command line switches, when available, can make a more seemless, robust script.

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  
Followers 0