JohnS Posted September 21, 2010 Share 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 Link to comment Share on other sites More sharing options...
somdcomputerguy Posted September 21, 2010 Share 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. Link to comment Share on other sites More sharing options...
Tankbuster Posted September 21, 2010 Share 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 Link to comment Share on other sites More sharing options...
JohnS Posted September 21, 2010 Author Share 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 Link to comment Share on other sites More sharing options...
wakillon Posted September 21, 2010 Share 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 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