Off-Topic
: K-Meleon Web Browser Forum
All which isn't K-Meleon related.
Go to:
Forum List
•
Message List
•
Search
•
Log In
Your Name:
Subject:
Help information
BBcode help
Smileys help
Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
[Please, enable JavaScript to see the code]
Enter code:
[quote=disrupted] kills the top process by memory usage. this can be useful when a program freezes ,consuming above normal memory and doesn't close normally, instead of opening the taskmanager and looking for the program, kill it with one click also when testing programs and a program gets in a loop due to bad coding you can kill it instantly. the program uses tasklist to write a log file which it then parses, the command is executed through a bat file (testshit.bat) which the user can edit to assign filters to top memory or filter out certain programs or windows services which must not be included since killing them might cause system restarts or you can filter out your regular background programs which should be excluded. only the top memory using program will be killed. for 2k and above only: [url=http://kmext.sourceforge.net/files/processkillplus.7z]http://kmext.sourceforge.net/files/processkillplus.7z[/url] source: [color=blue][sub] ; AutoIt Version: 3.3.0 ; Language: mary poppins ; Platform: Win9x/NT ; Author: yannis #include <string.au3> #include <file.au3> #include <Misc.au3> #include <Math.au3> #Include <Array.au3> #notrayicon if _Singleton("processkill",0) = 0 Then exit endif if WinExists("Synchronization Error...") Then ; this command is ffor nad player that can get stuck when playing some vbr(you probably won't encounter that problem) killnad() elseif processe-xists("autoit3.exe") then ;kills instances of autoit3, useful when running badly coded scripts(loop errors) killautoit() endif ;detects of cmdline/dos/batch files are disabled globally and enables them temporarily when the cript executes the bat $cmdstats=RegRead( "HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System", "DisableCMD") RegWrite("HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System" ,"DisableCMD", "REG_DWORD", 0) $proclogbat=(@scriptdir & "\testshit.bat") $proclist=("c:\list.txt") ShellExecute ($proclogbat , "" , "", "Open", @SW_HIDE) sleep(288) $processstr1=filereadline($proclist, 3) $getprocnam1=StringInStr ($processstr1, """" , 0, 2 ) $getprocnam2=StringMid($processstr1, 1, $getprocnam1) $getprocnam3=StringReplace($getprocnam2, """", "") $processstr2=filereadline($proclist, 4) ;msgbox(48, $getprocnam3, $getprocnam3) if $processstr2=("") then processclose($getprocnam3) else $getprocnam12=StringInStr ($processstr2, """" , 0, 2 ) $getprocnam22=StringMid($processstr2, 1, $getprocnam12) $getprocnam32=StringReplace($getprocnam22, """", "") ;msgbox(48, $getprocnam32, $getprocnam32) $processstr3=filereadline($proclist, 5) $getprocnam13=StringInStr ($processstr3, """" , 0, 2 ) $getprocnam23=StringMid($processstr3, 1, $getprocnam13) $getprocnam33=StringReplace($getprocnam23, """", "") ;msgbox(48, $getprocnam33, $getprocnam33) $processstr4=filereadline($proclist, 6) $getprocnam14=StringInStr ($processstr4, """" , 0, 2 ) $getprocnam24=StringMid($processstr4, 1, $getprocnam14) $getprocnam34=StringReplace($getprocnam24, """", "") ;msgbox(48, $getprocnam34, $getprocnam34) ;get memory $getmem1=StringInStr ($processstr1, """" , 0, 9 ) $getmem2=Stringtrimleft($processstr1, $getmem1) $getmem3=StringReplace($getmem2, """", "") $getmem4=StringReplace($getmem3, " k", "") $getmem5=StringReplace($getmem4, ",", "") ;msgbox(48, $getmem5, $getmem5) $getmem12=StringInStr ($processstr2, """" , 0, 9 ) $getmem22=Stringtrimleft($processstr2, $getmem12) $getmem32=StringReplace($getmem22, """", "") $getmem42=StringReplace($getmem32, " k", "") $getmem52=StringReplace($getmem42, ",", "") ;msgbox(48, $getmem52, $getmem52) $getmem13=StringInStr ($processstr3, """" , 0, 9 ) $getmem23=Stringtrimleft($processstr3, $getmem13) $getmem33=StringReplace($getmem23, """", "") $getmem43=StringReplace($getmem33, " k", "") $getmem53=StringReplace($getmem43, ",", "") ;msgbox(48, $getmem53, $getmem53) $getmem14=StringInStr ($processstr4, """" , 0, 9 ) $getmem24=Stringtrimleft($processstr4, $getmem14) $getmem34=StringReplace($getmem24, """", "") $getmem44=StringReplace($getmem34, " k", "") $getmem54=StringReplace($getmem44, ",", "") ;msgbox(48, $getmem54, $getmem54) ; restores original setting for batch dos commands(case disabled) RegWrite("HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System" ,"DisableCMD", "REG_DWORD", $cmdstats) $gethimem=($getmem5 & "," & $getmem52 & "," & $getmem53 & "," & $getmem54) $avArray = StringSplit($gethimem, ",") $maxprocess= _ArrayMax($avArray, 1, 1) ;msgbox(0,'Max Numeric value', _ArrayMax($avArray, 1, 1)) ;find program by top memory usage by placing memory usage values in an array if $maxprocess=$getmem5 then ;msgbox(48, "highest memory is", "process one") $processtokill=$getprocnam3 else if $maxprocess=$getmem52 then ;msgbox(48, "highest memory is", "process two") $processtokill=$getprocnam32 elseif $maxprocess=$getmem53 then ;msgbox(48, "highest memory is", "process three") $processtokill=$getprocnam33 else ;msgbox(48, "highest memory is", "process four") $processtokill=$getprocnam34 endif endif processclose("cmd.exe") ProcessClose("taskkill.exe") while processe-xists($processtokill) processclose($processtokill) wend exit endif exit Func killnad() ProcessClose("nad.exe") ProcessClose("taskkill.exe") ProcessClose("proces~1.exe") ProcessClose("processkillplus.exe") ProcessClose("proces~1.exe") ProcessClose("processkillplus.exe") sleep(1800) exit endFunc exit Func killautoit() while processe-xists("autoit3.exe") processclose("autoit3.exe") wend exit endFunc exit ;referenceforbat(internal) ;$makeprlog=("c:\windows\system32\tasklist.exe /fi " & """" & "imagename ne explorer.exe" & """" &" /fi " & """" &" /fi " & """" & "imagename ne liveipplus.exe" & """" &" /fi " & """" & "imagename ne freevoice.exe" & """" &" /fi " & """" & "imagename ne csrss.exe" & """" &" /fi " & """" & "imagename ne svchost.exe" & """" &" /fi " & """" & "imagename ne wmiprvse.exe" & """" &" /fi " & """" & "imagename ne OBJECT~1.EXE" & """" &" /fi " & """" &" /fi " & """" & "imagename ne ctfmon.exe" & """" &" /fi " & """" &" /fi " & """" &" /fi " & """" &" /fi " & """" & "imagename ne HydraDM.exe" & """" &" /fi " & """" & "imagename ne autoit3.exe" & """" &" /fi " & """" &" /fi " & """" &" /fi " & """" & "memusage gt 5000" & """" & " /fo csv >c:\list.txt") [/sub][/color] !IMPORTANT ediing the batch file(testshit.bat) the bat default looks like this: [color=brown][sub] tasklist /fi "imagename ne explorer.exe" /fi "imagename ne lsass.exe" /fi "imagename ne liveipplus.exe" /fi "imagename ne freevoice.exe" /fi "imagename ne csrss.exe" /fi "imagename ne svchost.exe" /fi "imagename ne wmiprvse.exe" /fi "imagename ne OBJECT~1.EXE" /fi "imagename ne ctfmon.exe" /fi "imagename ne Console.exe" /fi "imagename ne autoit3.exe" /fi "imagename ne tasklist.exe" /fi "imagename ne Ati2evxx.exe" /fi "imagename ne processkillplus.exe" /fi "imagename ne client.exe" /fi "imagename ne winlogon.exe" /fi "imagename ne spoolsv.exe" /fi "imagename ne mbprobe.exe" /fi "imagename ne ctfmon.exe" /fi "imagename ne spoolsv.exe" /fi "memusage gt 4600" /fo csv >c:\list.txt [/sub][/color] some of the entries are system services and should not be removed but you ca always add more programs to be filtered out i.e. those programs will never be included regardless of their memory usage(protected), client lsass winlogon explorer ctfmon csrss are examples f services and programs that must not be removed(always excluded) for example if you want to exclude a program like k-meleon, then add this string within the bat command [color=brown][sub]/fi "imagename ne k-meleon.exe"[/sub][/color] you can also specify the memory usage to return programs, the default is 4600, meaning programs using memory exceeding 4600 kb will be returned(except those excluded by fi/ ne 4600 is a bit low but is a personal preference due to autoit scripts that can get stuck even with low memory usage.. you can increase that value.. i think the norm to start checking for programs with hi mem usage is around 20000kb but that may vary from system to system..virtual memory/page file etc so edit this value to what's best for your system or normal idle usage use notepad or any text editor to edit testshit.bat extract anywhere you like, create a shortcut to processkillplus on your desktop or launcher[/quote]
[Please Enable JavaScript]
K-Meleon forum is powered by
Phorum
.
Home/News
Screenshots
Download
Documentation
Resources
Get Involved
Forum
FAQ
English