Sign in to follow this  
Followers 0
johntmcii

Trying to understand an optimal way to kill a window that may popup

6 posts in this topic

Hi, I'm a dinosaur learning AutoIT and IT's nice. I'm totally addicted. Thank you AutoIT community!

Any suggestions for something a little more elegant than this? I simply want to watch for and kill an annoying "Add-ons" window that a new portable Firefox installation creates. This works, but I'm having a hard time making up my mind on an optimal way to do the conditionals-- I like Switch for readability, and tried that, but I saw some other examples on the forum that confused me more than made-up my mind. Any suggestions or thoughts would be appreciated.

Dim $i = 500
        Do
            $x = WinExists("Add-ons")
            If $x = 1 Then
                    WinKill("Add-ons")
                Exit
            EndIf
            Sleep(500)
            $i = $i + 500
        Until $i = 5000

Share this post


Link to post
Share on other sites



If your script is only to kill win and nothing else this can 2 can work

HotKeySet("{ESC}", "_Exit")
While 1
    WinKill(WinWait("Add-ons"))
WEnd
Func _Exit()
    Exit
EndFunc

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

Thanks for the tips!

Share this post


Link to post
Share on other sites

The problem with following examples is that your script is not free to do anything else so it just kills windows.

What you may consider to do in the future is using TIMERS.

You can simply make a simple timer when your script starts or us AdLibRegister

Both of them assign a function that will be run when timer finishes(lets say every second the timer will trigger the function)

Then function checks if there are any annoying windows/popups

Func timerfunc()

If winexists("annoying popup") then

winclose("annoying popup")

endif

if winexists("some other annoying popup") then

...

endif

EndFunc

Share this post


Link to post
Share on other sites

What you may consider to do in the future is using TIMERS.

You can simply make a simple timer when your script starts or us AdLibRegister

Both of them assign a function that will be run when timer finishes(lets say every second the timer will trigger the function)

Nice, thanks!

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