GMXeon Posted October 2, 2007 Share Posted October 2, 2007 (edited) Ok, I simply wanted to make a small app that would scan for internet explorer and kill it (I have adware I knew i was installing but now it's uninstalled but sometimes still works >_>) I use firefox to browse the interner so I don't need IE for anything, but I don't want to uninstall it and I tried to overwrite the exe with a quick self closing app but it just overwrites it with the old IE every 5 seconds. So here's my source... TrayTip ( "Status: Ready", "Internet Explorer killer is now scanning for Internet Explorer and is ready to kill it.", 10 ); sleep(5000); call("IExploreCheck"); Func IExploreCheck(); $PID = ProcessExists("iexplore.exe"); if $PID then call("IExploreKill") Else call("IExploreWait") EndIf; EndFunc; Func IExploreKill(); $PKill = ProcessClose("iexplore.exe"); If $PKill = 1 then TrayTip ( "Status: IExplore Killed", "Internet Explorer has been detected and has been immdeiately closed.", 10 ); sleep(2000); call("IExploreCheck"); EndFunc; Func IExploreWait(); sleep(2000); call("IExploreCheck"); EndFunc; And yes, I know I don't need the ; after everything, it's habit from C++ >_>. Basically this app when compiled with aut2exe will run for a while, but in task manager it shows its mem increasing slowly and steadily, like 16/second, until it closes after a certain amount, which ends up being like 2 minutes. I figure this is a infinte loop protection feature of AutoIt 3, can anyone help me get past it? Why does its mem keep going up? I can't go much faster than 200 millisecond wait because then it also starts eating up CPU which I can't have. Help please? I know this is a very newbie question, and the search isn't helpful because there are so many unrelated posts containing the keywords... Edited October 2, 2007 by GMXeon Link to comment Share on other sites More sharing options...
Shevilie Posted October 2, 2007 Share Posted October 2, 2007 (edited) I think your in a recursive loop - Maximum depth of recursive function calls: 384 levels Im not quite sure thats the problem, but have a try with this. TrayTip ( "Status: Ready", "Internet Explorer killer is now scanning for Internet Explorer and is ready to kill it.", 10 ); Func IExploreCheck(); if ProcessExists("iexplore.exe") then $PKill = ProcessClose("iexplore.exe"); If $PKill = 1 Then TrayTip ( "Status: IExplore Killed", "Internet Explorer has been detected and has been immdeiately closed.", 10 ); EndIf EndIf EndFunc While 1 sleep(2000); IExploreCheck(); WEnd Edited October 2, 2007 by Shevilie Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
GMXeon Posted October 2, 2007 Author Share Posted October 2, 2007 While 1 sleep(2000); IExploreCheck(); WEndDo you mean call("IExploreCheck") or can I just type IExploreCheck? Link to comment Share on other sites More sharing options...
aslani Posted October 2, 2007 Share Posted October 2, 2007 I see why the RAM uses increases, it's because you kept on calling functions within eachother. This could be your solution; TrayTip ( "Status: Ready", "Internet Explorer killer is now scanning for Internet Explorer and is ready to kill it.", 10 ); While 1 If ProcessExists("iexplore.exe") Then $PKill = ProcessClose("iexplore.exe") If $PKill = 1 then TrayTip ( "Status: IExplore Killed", "Internet Explorer has been detected and has been immdeiately closed.", 10 ) EndIf WEnd [font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version Link to comment Share on other sites More sharing options...
Shevilie Posted October 3, 2007 Share Posted October 3, 2007 Do you mean call("IExploreCheck") or can I just type IExploreCheck?Yea you can run functions just like IExploreCheck() Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
smashly Posted October 3, 2007 Share Posted October 3, 2007 (edited) Hi, #NoTrayIcon HotKeySet("!{ESC}", "Close") ;Alt + Esc to quit Global $n = 0 While 1 ToolTip ("Number Of IE Kills: " & $n & @LF & "Alt + Esc to quit", -1, -1, "IE Killer Active.") ProcessWait("iexplore.exe") ProcessClose("iexplore.exe") ProcessWaitClose("iexplore.exe", 250) $n += 1 WEnd Func Close() Exit EndFuncoÝ÷ Øay-ìÊØ^r^Á«"·¬mõ®'§vìȶ+b·¥åÊZ(¦'íèÆhêk¡Ç¬²+(¥éÞvn±§]yÖ¤Y¢éí@u×j-ì¡ë[~Ç-¢«¢´(^z»v+Rëâ'²V§è¶'Ê¢Øaj÷ºÚ"µÍÌÍÔÚ[HØÙÜÐÛÜÙJ ][ÝÚY^ÜK^I][ÝÊBY ÌÍÔÚ[HH[Correct me if I'm wrong but.. ProcessClose() doesn't have a return or so it says in the help file... So checking if $PKill = 1 seems sorta redundant... am I missing something there?.. lol Edited October 3, 2007 by smashly Link to comment Share on other sites More sharing options...
aslani Posted October 3, 2007 Share Posted October 3, 2007 Correct me if I'm wrong but.. ProcessClose() doesn't have a return or so it says in the help file... So checking if $PKill = 1 seems sorta redundant... am I missing something there?.. lol TrayTip ( "Status: Ready", "Internet Explorer killer is now scanning for Internet Explorer and is ready to kill it.", 10 ); While 1 If ProcessExists("iexplore.exe") Then $PKill = ProcessClose("iexplore.exe") If $PKill = 1 then TrayTip ( "Status: IExplore Killed", "Internet Explorer has been detected and has been immdeiately closed.", 10 ) MsgBox(0,"", $PKill) EndIf WEnd Despite what's written in Helpfile, $PKill returns 1 when ProcessClose() succeeded. If the check is not in place, you'll receive the TrayTip() that it was a success even if ProcessClose() failed. [font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version Link to comment Share on other sites More sharing options...
HeffeD Posted October 3, 2007 Share Posted October 3, 2007 Why not spend your efforts fixing the problem instead of the symptoms? I think you'd be better off getting rid of the malware on your system instead of writing scripts to close IE whenever it opens. Maybe that's just me... Link to comment Share on other sites More sharing options...
smashly Posted October 3, 2007 Share Posted October 3, 2007 I do agree with HeffeD view , but original the question was to fix a loop in a script. TrayTip ( "Status: Ready", "Internet Explorer killer is now scanning for Internet Explorer and is ready to kill it.", 10 ); While 1 If ProcessExists("iexplore.exe") Then $PKill = ProcessClose("iexplore.exe") If $PKill = 1 then TrayTip ( "Status: IExplore Killed", "Internet Explorer has been detected and has been immdeiately closed.", 10 ) MsgBox(0,"", $PKill) EndIf WEnd Despite what's written in Helpfile, $PKill returns 1 when ProcessClose() succeeded. If the check is not in place, you'll receive the TrayTip() that it was a success even if ProcessClose() failed. ProcessClose() will also return 1 if it fails , so it sorta blows your theory out the water about showing a tooltip only on success. since $PKill will always equal 1 in your loop along with your cpu usage will always be maxed out using your code as it is... Cheers 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