JohnS 0 Posted September 21, 2010 (edited) Hi all. I know nothing about scripting in Autoit, so I searched in the forum here and there and joined two pieces of code that work isolated but when I put them together don't. My friend likes and uses a file sharing program called Piolet, that opens a publicity popup in IE every 20 seconds or so. So I want: 1-That the script closes the popups; 2-That the script ends when Piolet closes. But only 1 is executing, although I have tested 1 and 2 separatly with sucess. Can someone help, please? Thank you, John Opt("WinTitleMatchMode", 4) Run("C:\Programas\Piolet\Piolet.exe", "") WinWait("Piolet") ; Close Internet Explorer popups While 1 Sleep(20000) If WinExists("classname=IEFrame") Then WinKill("classname=IEFrame") EndIf WEnd ; Wait until Piolet closes $_ProcessName = 'Piolet.exe' While 1 If Not ProcessExists ( $_ProcessName ) Then Exit Sleep ( 750 ) WEnd Edited September 21, 2010 by JohnS Share this post Link to post Share on other sites
somdcomputerguy 103 Posted September 21, 2010 (edited) I haven't tested this, but I think it should work ok.. Opt("WinTitleMatchMode", 4) Run("C:\Programas\Piolet\Piolet.exe", "") WinWait("Piolet") $_ProcessName = 'Piolet.exe' While 1 If Not ProcessExists ( $_ProcessName ) Then Exit If WinExists("classname=IEFrame") Then WinKill("classname=IEFrame") Sleep(100) WEnd Edited September 21, 2010 by somdcomputerguy - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Share this post Link to post Share on other sites
Tankbuster 3 Posted September 21, 2010 (edited) ; Close Internet Explorer popups While 1 Sleep(20000) If WinExists("classname=IEFrame") Then WinKill("classname=IEFrame") EndIf WEnd The "while" always is true without any condition to exit. In the script of somdcomputerguy there is a condition to exit the while. And one While is good enough :-) Just to give you some hints where you start to search the help file for some more details: While, Exitloop Edited September 21, 2010 by Tankbuster Share this post Link to post Share on other sites
JohnS 0 Posted September 21, 2010 Thank you somdcomputerguy. Your script works. Tankbuster: I tried to learn and what you say makes sense: there is no need for the if-then. So I tried this, but it doesn't work: While 1 WinExists("classname=IEFrame") WinKill("classname=IEFrame") Sleep(1000) WEnd Share this post Link to post Share on other sites
wakillon 403 Posted September 21, 2010 Another way : Do If WinExists("classname=IEFrame") Then WinKill("classname=IEFrame") Sleep(100) Until Not ProcessExists ( $_ProcessName ) AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Share this post Link to post Share on other sites