Main Area and Open Discussion > General Software Discussion
help.... need a tool/utility to auto terminate a process
zeemar:
Thank you Lanux
lanux128:
zeemar,
instead of throwing in a input-box, i've decided to add an INI file for any modification. now the script should repeat itself and allow you to edit the list externally.
ok, here you go... :up:
the modified code: Mach2; To kill some tasks prior to running any CPU-intensive apps
; Date: 18/03/2006 ;Last Updated: 09/05/2006
; Modified from its original version due to a request in DC forums
; Refer: hxxp://www.donationcoder.com/forum/index.php?topic=3413.0
; Note:
; ***** Needs PsKill by SysInternals
; ***** hxxp://www.sysinternals.com/Utilities/PsKill.html
; ***** Adjust path to PsKill as necessary...
; Changes since:
; ***** Made the script to repeat itself (SetTimer)
; ***** Added INI file to add new processes
; ***** Due to script's persistent nature, added Alt+Q hotkey to quit.
#SingleInstance force
;#NoTrayIcon
#Persistent
DetectHiddenWindows On
SetTitleMatchMode 2 ; not sure if needed but just in case.
;declare all unwanted processes
;just processes' name will do
ToClose =
( Join|
InoRT
jusched
InoTask
)
Gosub, Get_INI
SetTimer, CloseAll, 500
Return
Get_INI:
IfNotExist, ToClose.ini
{
comments=
comments=`;This file contains the list of unwanted processes
comments=%comments%`n`;Separate these processes with a pipe (|)
comments=%comments%`n`;
FileAppend,%comments%,ToClose.ini
Iniwrite,%ToClose%,ToClose.ini,Settings,ProcessList
}
Else ;INI file exists, read from it
{
IniRead,ToClose,ToClose.ini,Settings,ProcessList
}
Return
CloseAll:
Loop, Parse, ToClose, |
{
Process, Exist, %A_LoopField%.exe
NewPID = %ErrorLevel% ; Save the value since ErrorLevel often changes.
If NewPID <> 0 ;
{
;MsgBox Process %A_LoopField%.exe is found, with the process ID of %NewPID%. ;test var
Run, %ProgramFiles%\SysTools\pskill.exe %NewPID%
}
}
Return
;Alt+q exits...
!q::ExitApp
zeemar:
Thank you lanux, for all your help.
It is working great.
lanux128:
Thank you lanux, for all your help.
It is working great.-zeemar (May 11, 2006, 08:30 AM)
--- End quote ---
u're welcome... ;D
SexyLilDarkPaw:
Hi all, Wonderful suggestions,
Quick question for jgpaiva though, Is there a maximum number of processes that can be killed at once? (or a text limiter to the commandline?) or can i just copy a huge list of exe's into it for example
exe1,exe2,3,4,....20
Thanks in advance XD, Definitely one to add to my software collection :-p
ttyl
Felicia
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version