johntmcii Posted April 2, 2011 Share Posted April 2, 2011 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 Link to comment Share on other sites More sharing options...
Rogue5099 Posted April 2, 2011 Share Posted April 2, 2011 Try this. It will continue to loop until you hit the ESC key then it will Exit. HotKeySet("{ESC}", "_Exit") While 1 If WinExists("Add-ons") Then WinKill("Add-ons") Sleep(100) WEnd Func _Exit() Exit EndFunc My projects: Inventory / Mp3 Inventory, Computer Stats Link to comment Share on other sites More sharing options...
bogQ Posted April 2, 2011 Share Posted April 2, 2011 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 connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) 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. Link to comment Share on other sites More sharing options...
johntmcii Posted April 3, 2011 Author Share Posted April 3, 2011 Thanks for the tips! Link to comment Share on other sites More sharing options...
Aktonius Posted April 3, 2011 Share Posted April 3, 2011 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 Link to comment Share on other sites More sharing options...
johntmcii Posted April 3, 2011 Author Share Posted April 3, 2011 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 AdLibRegisterBoth of them assign a function that will be run when timer finishes(lets say every second the timer will trigger the function)Nice, thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now