Jump to content
Sign in to follow this  
redfive19

If this window EVER appears...

Recommended Posts

redfive19

Hi guys,

I searched first for this but to no avail. Maybe I didn't use the correct search criteria. Either way, I am trying to have AutoIt close a window if and whenever it appears. Case in point....sometimes a Found New Hardware wizard window pops up, sometimes it doesn't. Sometimes it pops up once, sometimes twice. It's very incosistent. I basically want AutoIt to close the window anytime it pops up. I tried using a "while" expression but it hangs and doesn't execute the rest of the script. The rest of the script installs the drivers (which Windows doesn't have by default)....

If WinExists("Found New Hardware Wizard", "") Then
WinActivate("Found New Hardware", "hp LaserJet 3030")
ControlClick("Found New Hardware Wizard", "hp LaserJet 3030", "Button6")
EndIf

I want to do this each and everytime the window pops up. Maybe someone can point me in the right direction? Thanks in advance.

-redfive

Share this post


Link to post
Share on other sites
CyberSlug

AdlibEnable("GetRidOfPopup")

; your main script stuff goes here....
Exit

Func GetRidOfPopup()
  If WinExists("Found New Hardware Wizard", "") Then
    WinActivate("Found New Hardware", "hp LaserJet 3030")
    ControlClick("Found New Hardware Wizard", "hp LaserJet 3030", "Button6")
  EndIf
EndFunc


Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites
buzz44

Put it in a loop so its continously running.

While 1
   If WinExists("Found New Hardware Wizard", "") Then
      WinActivate("Found New Hardware", "hp LaserJet 3030")
      ControlClick("Found New Hardware Wizard", "hp LaserJet 3030", "Button6")
   EndIf
Wend

Beat me to it CyberSlug :)

Edited by burrup

qq

Share this post


Link to post
Share on other sites
redfive19

You guys are both very generous!!! Thank you very much, worked a charm!

-redfive

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.