Start, stop or kill processes.

CKS Tool - Commandline Process Management Complete commandline mangement of processes.

We are using mediacenter software for years. Regardsless of the vendor (Sceneo, Microsoft, Yahoo) or free of charge (MediaPortal, Meedio, MeediOS etc.) there is always a tool or function missing.

Maybe you have unstable services, problems with drivers or addons. You need to automate steps, close and or start programs etc.

To solve a few of this issues we’ve created a smal tool to assist in these cases. It’s not only worth a view for media center users…


WARNING:

If you have read this and still no clue what it can do for you – leave it alone

If you have no knowledge about processes and what a kill of a process can cause – leave it alone

Ergo: Use it at your own risk or leave it alone

You’ve been warned…

Requirements

It’s tested and approved for Windows XP only. May run with 2000/2003/Vista/2008 also. May need admin rights to close/kill a process not owned by the user

What is it good for?

CKS-Tool (Close, Kill Start Tool (-; can start and stop/kill apps/processes in a given order. If an app or process can not be closed it will be killed (tried to (:You may find CKS-Tool convenient if

- You need to close kill a set of processes or apps by one click with your remote control software

- You need to start or stop services but without the ugly cmd window

- You can define all your sets of apps to close or/and start in one ini-file

- You can call each set from the commandline

- You can supress any output (flawless/invisible integration in your mediacenter)

- You need to start an app but you don’t wanna see a black commandline window (hidden start)

- You need to start a few apps with waits between starts

- You need to start a few depending programs, links etc. in a well defined order

- You need to close processes or applications that have no programm window by script or on demand

- You need to start apps after closing others (e.g. close process that lock files and start your backup tool)

- You need to restart unstable software insistence on one ore more processes and/or services

- You need to start a process and send a few keystrokes to the app window after initialize

- You need to end/kill tasks that reinstalls itself everytime in the Windows autostarts (MS ActiveSync e. g.)

- You can debug your settings with a progress dialog

- You need a freeware tool for that

How does it work?

You can define sections in the ini-file of the CKS-Tool.exe The ini-file is expected to be in the same directory as the exe. Each section in the ini can have it’s own set of nine entries per services, per processes to kill and per processes to start. The number of sections is not limited (maybe by windows, we don’t care ).

CKS-Tool first always tries to close (wm_close is send to it) an app or process. Only if that fails, it tries to kill it. Services will be startet and stopped via the service process manager.

Furthermore you can define how long CKS-Tool waits before a kill is send to the process, after it has had no success to close it gently.

If you start CKS-Tool with the section name which you’ve created (e.g. "CKS-Tool.exe testsection" see below) the following happens:

1.) Each process named in the item "StopServiceX" (X in 1..9) will be closed by using the stop service via service handler. Than all processes in items "StopProcessX" receive a wm_close message in the order of the numbering

2.) CKS-Tool then waits the specified number of seconds defined in item "WaitBeforeKill"

3.) Then it checks if any of the processes (not services!) in 1.) is still alive. If so, it kills them if possible (e. g. a system process may deny such an attempt)

After that CKS-Tool checks if further items for starting programs are defined in the ini file. Each entry for a program / app / process start can consist of 6 entries:

; set if items for one process (out of max. 9 per section) app to start

WaitBeforeStartX=

OptionsX=

WorkDirX=

StartProcessX=

WaitBeforeSendKeysX=

SendKeysX=

X can be a number from 1 to 9. The item set will execute in the order from 1 to 9. This makes it possible to define starts and delayed starts for depending applications. An example entry:

; ‘Testsection’ (without the quotes) has to be the

; command line option when starting CKS-Tool.exe

; to execute the content of this section

[TestSection]

ProgressDlg=on

WaitBeforeKill=5

EndProcess1=WellKnownTask.exe

EndProcess2=notepad.exe

WaitBeforeStart1=5

Options1=max

WorkDir1=c:\windows\system32

StartProcess1=notepad.exe c:\boot.ini

WaitBeforeStart2=10

Options2=

WorkDir2=c:\windows\system32

StartProcess2=services.msc

4.) Wait 5 Seconds

5.) Start notpad.exe and open c:\boot.ini

6.) Wait 10 Seconds (WaitbeforeStart2=10) and run service manager console

CKS-Tool displays a progress dialogbox with information on whats going on. If you don’t wan’t that dialog you can disable it in your section in the ini file. Default is on. This is a per section option.

ProgressDlg=off

WaitBeforeSendKeysX waits the given number of seconds after starting the application / process.

SendKeysX sends the given Keys to the forground window (hopefully your started application (:

The syntax for the Keys is analog to Autohotkey’s syntax: http://www.autohotkey.com/docs/commands/Send.htm

No syntax checks will be done. CKS-Tool sends the hole string according to the autohotkey syntax to your program. You have got to take care of it yourself. An Example of that powerful function is inside the ini file.

Firefox example

Firefox lags the option to start in Fullscreen or kiosk mode by using a command line option. This is possible by hitting F11 after the start of the browser. This makes sense especially, if you wann use a great and skinned browser with your mediacenter, but you don’t wanna show menues or other windows like design.

[StartFirefoxFullScreen]

ProgressDlg=off

;nothing to close or kill

WaitBeforeKill=0

; go right away

WaitBeforeStart1=0

;maximize firefox win on start

Options1=max

;workdir

WorkDir1=C:\Programme\Firefox

;exe to start

StartProcess1=firefox.exe

;starts are always asyncronus, so we have to give Firefox a few seconds to initialize

WaitBeforeSendKeys1=4

;send F11 Key for fullscreen view of firefox

SendKeys1={F11}

Use "chs-tool.exe StartFirefoxFullScreen" from a command menue. This starts the browser without showing any window (e.g. cmd window) and sends "F11" key to firefox after it is initalised.

Software updatet on 27.03.2008. Please see the readme and the ini file inside the archive for more detailed examples and informations.

Download: CKS-Tool

Verbreite das!
    Schlagwörter: , , ,

    Über Fx

    Betriebswirt, Entwickler, Datenbankspezialist, Administrator und selbständiger Projektmanager. Für die Piratenpartei Aachen als Pressemensch, im Rat der Stadt Aachen und im Finanzausschuss aktiv. Bei den Texten handelt sich es immer um meine eigene Meinung und Einschätzung. Diese kann, muss aber nicht mit einer Parteimeinung übereinstimmen.