Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • September 02, 2015, 06:54:07 PM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Last post Author Topic: help.... need a tool/utility to auto terminate a process  (Read 23930 times)

zeemar

  • Participant
  • Joined in 2005
  • *
  • default avatar
  • Posts: 32
    • View Profile
    • Donate to Member
Re: help.... need a tool/utility to auto terminate a process
« Reply #25 on: May 05, 2006, 09:27:37 AM »
Hi Lanux

I Installed AutoHotKey now

is this the right way ...

...
;declare all unwanted processes
;just processes' name will do
ToClose =
( Join|
AllChars     ; InoRT.exe
CLCL         ; InoTask.exe
avgamsvr   ; xyz.exe
avgcc       ; your process goes here
avgupsvc   ; your process goes here
)

Thanks for your help Lanux

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: help.... need a tool/utility to auto terminate a process
« Reply #26 on: May 05, 2006, 09:31:54 AM »
Hi Lanux

I Installed AutoHotKey now

is this the right way ...

...
;declare all unwanted processes
;just processes' name will do
ToClose =
( Join|
AllChars     ; InoRT.exe
CLCL         ; InoTask.exe
avgamsvr   ; xyz.exe
avgcc       ; your process goes here
avgupsvc   ; your process goes here
)

Thanks for your help Lanux
I think Lanux meant something like this:

Code: [Select]
;declare all unwanted processes
;just processes' name will do
ToClose =
( Join|
InoRT 
InoTask   
xyz.exe 
)
Everything that comes after ';' is a comment, so, it's ignored.
Don't forget you'll still need pskill ;)

zeemar

  • Participant
  • Joined in 2005
  • *
  • default avatar
  • Posts: 32
    • View Profile
    • Donate to Member
Re: help.... need a tool/utility to auto terminate a process
« Reply #27 on: May 05, 2006, 10:06:23 AM »
Thanks Jpaigva for the clarification.

I created a EXE using ahk2exe but when i run it nothing happens.

Could somebody check this code and tell me if some thing is wrong.

Spoiler
; To kill some tasks prior to running any CPU-intensive apps
; Date: 18/03/2006
; Modified from its original version due to a request in DC forums
; Refer: hxxp://www.donationcoder.com/forum/index.php?topic=3413.0
; Adjust path to PsKill as necessary...

#SingleInstance ignore
#NoTrayIcon
DetectHiddenWindows On
SetTitleMatchMode 2   ; not sure if needed but just in case.

;declare all unwanted processes
;just processes' name will do
ToClose =
( Join|
InoRT.exe
jusched.exe
InoTask.exe
)
;MsgBox %ToClose% ;test var

;Close AllChars, CLCL, AVGamsvr, AVGcc, AVGupsvc
Loop, Parse, ToClose, |
{
  ;MsgBox, Process #: %A_Index% is %A_LoopField%. ;test var
  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, C:\MyPrograms\CommonApps\SysTools\pskill.exe %NewPID%
    }
}
Return


Thanks

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: help.... need a tool/utility to auto terminate a process
« Reply #28 on: May 05, 2006, 10:21:24 AM »
zeemar: Do you have pskill (http://www.sysintern...tilities/PsKill.html) in the same directory as that script?

zeemar

  • Participant
  • Joined in 2005
  • *
  • default avatar
  • Posts: 32
    • View Profile
    • Donate to Member
Re: help.... need a tool/utility to auto terminate a process
« Reply #29 on: May 05, 2006, 10:27:21 AM »
Yes i have pskill.exe in the same directory as i had in the script.

Thanks

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: help.... need a tool/utility to auto terminate a process
« Reply #30 on: May 05, 2006, 10:55:57 AM »
All looks in order, zeemar. It should kill the processes.
My processkiller didn't work too, but it works on my computer. That's very strange.
Anyone has any other opinion on this?

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,219
    • View Profile
    • Coding Snacks by Lanux128
    • Donate to Member
Re: help.... need a tool/utility to auto terminate a process
« Reply #31 on: May 07, 2006, 07:50:08 PM »
...
I created a EXE using ahk2exe but when i run it nothing happens.

Could somebody check this code and tell me if some thing is wrong.

zeemar:
actually, you need to specify like this:
;declare all unwanted processes
;just processes' name will do
ToClose =
( Join|
InoRT
jusched
InoTask

)


without the .exe because in the line below, each of the processes is added with .exe (of course, this is not good for portability but then i hadn't checked it thoroughly)
  Process, Exist, %A_LoopField%.exe

sorry for the confusion...
btw, jgpaiva tks for standing-in...

zeemar

  • Participant
  • Joined in 2005
  • *
  • default avatar
  • Posts: 32
    • View Profile
    • Donate to Member
Re: help.... need a tool/utility to auto terminate a process
« Reply #32 on: May 08, 2006, 08:50:16 AM »
Thanks Lanux,

After making that change the script worked great.

Can it be further customized ?

- To monitor the processes every 15 mins or so and kill them.
- To have an input dialog which takes in the list of processes, like the processKiller created by jpaigva

Currrently when I run the EXE generated from the script ...it kills the processes if they are running but when the processes are restarted ...i have to manually run the EXE again.

Thanks for all your help

noth(a)nk.you

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 78
  • More than meets the eye.
    • View Profile
    • Donate to Member
Re: help.... need a tool/utility to auto terminate a process
« Reply #33 on: May 08, 2006, 09:30:17 AM »
Is AHK code extensible to allow for the path name of processes?  (Some are uppity enough to take names like "setup.exe.")

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,219
    • View Profile
    • Coding Snacks by Lanux128
    • Donate to Member
Re: help.... need a tool/utility to auto terminate a process
« Reply #34 on: May 08, 2006, 10:30:33 PM »
- To monitor the processes every 15 mins or so and kill them.
- To have an input dialog which takes in the list of processes, like the processKiller created by jpaigva
glad to see it was of use to you, zeemar.. :)
as for the 1st request, SetTimer function can do the trick. modify the code as below, the newly-added lines are in blue:
the modified code
; To kill some tasks prior to running any CPU-intensive apps
; Date: 18/03/2006
; Modified from its original version due to a request in DC forums
; Refer: hxxp://www.donationcoder.com/forum/index.php?topic=3413.0
; Adjust path to PsKill as necessary...
; Added SetTimer

#SingleInstance ignore
#NoTrayIcon
#Persistent
DetectHiddenWindows On
SetTitleMatchMode 2   ; not sure if needed but just in case.

SetTimer, CloseAll, 250
Return

CloseAll:

;declare all unwanted processes
;just processes' name will do
ToClose =
( Join|
InoRT
jusched
InoTask
)

;Close processes
Loop, Parse, ToClose, |
{
  Process, Exist, %A_LoopField%.exe
  NewPID = %ErrorLevel%   ; Save the value since ErrorLevel often changes.
  If NewPID <> 0          ;
    {
    Run, %ProgramFiles%\SysTools\pskill.exe %NewPID%
    }
}
Return


as for the 2nd request, i'll take a look at jgpaiva's script & then work-out something.

zeemar

  • Participant
  • Joined in 2005
  • *
  • default avatar
  • Posts: 32
    • View Profile
    • Donate to Member
Re: help.... need a tool/utility to auto terminate a process
« Reply #35 on: May 09, 2006, 09:33:34 AM »
Thank you Lanux

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,219
    • View Profile
    • Coding Snacks by Lanux128
    • Donate to Member
Re: help.... need a tool/utility to auto terminate a process
« Reply #36 on: May 09, 2006, 09:16:14 PM »
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

  • Participant
  • Joined in 2005
  • *
  • default avatar
  • Posts: 32
    • View Profile
    • Donate to Member
Re: help.... need a tool/utility to auto terminate a process
« Reply #37 on: May 11, 2006, 08:30:53 AM »
Thank you lanux, for all your help.

It is working great.

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,219
    • View Profile
    • Coding Snacks by Lanux128
    • Donate to Member
Re: help.... need a tool/utility to auto terminate a process
« Reply #38 on: May 14, 2006, 04:59:23 AM »
Thank you lanux, for all your help.

It is working great.
u're welcome... ;D

SexyLilDarkPaw

  • Participant
  • Joined in 2006
  • *
  • default avatar
  • Posts: 28
    • View Profile
    • Donate to Member
Re: help.... need a tool/utility to auto terminate a process
« Reply #39 on: May 26, 2006, 09:18:55 PM »
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

Gerome

  • Charter Honorary Member
  • Joined in 2006
  • ***
  • Posts: 154
    • View Profile
    • Get my Freestyle Basic Script Language + compiler!
    • Donate to Member
Re: help.... need a tool/utility to auto terminate a process
« Reply #40 on: May 27, 2006, 01:11:41 AM »
Hello,

Gerome,

This works fine, but i wanted to avoid manually clicking. If possible I want to have a program which monitors for these processses and issues this type of command to kill them.

Thanks

Here is a complete and GUI version of my process killer.
It works from Win95b up to Vista Beta 2 version :)
Code: [Select]
#Option Explicit
#DllDeclare Kernel32( "CloseHandle", "OpenProcess", "TerminateProcess" )
#DllDeclare User32( "FindWindow", "GetWindowThreadProcessId" )

Const NBSECTOWAITBEFORE = 10

Sub Cleaner()
  Fbsl_settext( hLabel, " > Killer @" & Time(1) & ":" & Time(2) & ":" & Time(3) & " <" )
  '// Put your program list here: its class name or its caption
  Kill( "Notepad", Null )
  Kill( "XLMAIN", Null )
End Sub

Function Kill( byVal szClass, byval szCaption ) As Integer
Dim %pid = 0, %hWnd = 0, %hProc = 0, %PROCESS_TERMINATE = 1
    hwnd = FindWindow( szClass, szCaption )
    If hwnd = 0 Then Return False
    GetWindowThreadProcessId( hWnd, @pid )
    If pid = 0 Then Return False
    hProc = OpenProcess( PROCESS_TERMINATE, False, pid )
    If hProc Then
        TerminateProcess( hProc, 0 )
        CloseHandle( hProc )
        Return True
    End If
    Return False
End Function

Dim %hLabel = FBSL_Control (_
            "static", Me, "zzzz", 1000, 20, 20, 170, 20,_
            WS_CHILD + SS_LEFT + WS_VISIBLE, WS_EX_TRANSPARENT )
FBSL_SetFont(hLabel, "Arial", 12, FW_BOLD, 0 ,0 ,0)
Fbsl_SetFormColor( Me, RGB(128,0,0) )

Cleaner()
SetTimer( Me, 1000, NBSECTOWAITBEFORE * 1000 )

Resize( Me, 0, 0, 220, 90 )
Fbsl_settext( Me, "Process killer" )
Center(Me)
Show(Me)

Begin Events
    Select Case cbmsg
      Case wm_timer
    Cleaner()
      Case wm_close
        Killtimer(Me, 1000)
        Exitprogram(-1)
    End Select
End Events
Yours,
(¯`·._.·[Gerome GUILLEMIN]·._.·´¯)
http://www.fbsl.net [FBSL Author]
http://gedd123.free.fr/FBSLv3.zip [FBSL Help file]
(¯`·._.·[If you need help... just ask]·._.·´¯)

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: help.... need a tool/utility to auto terminate a process
« Reply #41 on: May 27, 2006, 04:15:06 AM »
Hi Felicia!
Does ProcessKiller work for you? It strange it didn't work for zeemar.
No, no problem, if you don't go over the 4mb of text (which would take like..hum...20k words? ;)), no problem. At least, it shouldn't.
Oh, and to use a big list, maybe you should think about using the command line parameters, so that you don't have to paste the whole line everytime you run it. (just remember that for the commandline parameters, the names of the processes are separated by spaces, and not commas.)
bye!

nite_monkey

  • Member
  • Joined in 2006
  • **
  • Posts: 711
    • View Profile
    • Just Plain Super
    • Donate to Member
Re: help.... need a tool/utility to auto terminate a process
« Reply #42 on: April 04, 2007, 05:35:11 PM »
YAY! ;D Thank you jgpaiva processkiller is the best single file program I have downloaded, Now the annoying windows update please restart box won't keep popping up on me. (Yes I could disable it, but I am too lazy to do that, and I may want it back later, I dunno)
[Insert really cool signature here]

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: help.... need a tool/utility to auto terminate a process
« Reply #43 on: April 04, 2007, 07:04:52 PM »
YAY! ;D Thank you jgpaiva processkiller is the best single file program I have downloaded, Now the annoying windows update please restart box won't keep popping up on me. (Yes I could disable it, but I am too lazy to do that, and I may want it back later, I dunno)
You're welcome!!

BTW.... How could i disable that? :D

nite_monkey

  • Member
  • Joined in 2006
  • **
  • Posts: 711
    • View Profile
    • Just Plain Super
    • Donate to Member
Re: help.... need a tool/utility to auto terminate a process
« Reply #44 on: April 04, 2007, 09:16:18 PM »
you disable it from the computers group policies. goto this page, it has a registry way to disable it, and it also have the group policies way to disable it.
[Insert really cool signature here]