Home
Downloads
TEdit
CViewer
Quiet
Keep Clicking
Keyboard Config
DriverLoad
Moo
HelpExec
PPC Cabinet I
Short Hand
Are You Up Yet?
Webload
Multicol Listbox
Button Bar
Scrollable Frame
Media
Blog Roll
Contact

 

HelpExec

 

Introduction

 

I wrote HelpExec so that I can run some Tcl scripts on my PC. True, after you install Tcl for windows, you can just click on the Tcl (.tcl) file icon to run the script... but it doesn't always work that way... for example, I want to be able to view text files by right clicking on their icons and choose Send To to view them with my application, which is a Tcl/Tk script. I cannot put app.tcl (my script) in windows/sendto directory directly - because Windows' Send To won't invoke my the Tcl interpreter in that case. How does HelpExec help? I creat a directory, call it c:\myapp\ (or whatever), inside which I put HelpExec.exe and another file called cmdline.txt. cmdline.txt has only one line of text, which is

 

COMMANDLINE "c:/tcl/bin/wish.exe" -f "c:/programs/tcl/app.tcl"

 

Then I put a link to c:/myapp/helpwin.exe at windows\sendto directory, and call it MyApp... Voi la! Whenever I Send To a file to myapp, HelpExec.exe passes the target file to my editor script! Here is how it works: When HelpExec is excuted, it looks for a file called cmdline.txt in the same directory. It parses the file and execute whatever the file tells it to. The file cmdline.txt is only a text file where each line takes the format of

 

<directive> <argument> [<argument> ...]

 

where directive is one of COMMANDLINE, DIRECTORY or WAIT, case sensitive, described as follow:

  • The COMMANDLINE directive tells HelpExec what to execute. HelpExec takes this line, appends whatever argument(s) is/are passed to HelpExec, and executes the line as a windows command line.
  • The DIRECTORY directive tells HelpExec what directory to execute the command line
  • The WAIT directive takes one argument, which is either 0 or 1. 0 signifies HelpExec should not wait for the spawned program to be input idle before it exits, 1 signifies otherwise.

 

In my above example, if I Send To a file called myfile.txt, here is what will happen:

  • Windows calls the link file, which actually is HelpExec.exe, with the argument myfile.txt
  • HelpExec looks up cmdline.txt, finds and parses the command line, then appends myfile.txt to it, and executes, hence the command executed is something like

 

"c:/tcl/bin/wish.exe" -f "c:/programs/tcl/app.tcl" /myfile.txt

  • wish.exe (in fact, Tcl interpreter) is run, which takes the 3 arguments -f, "c:/programs/tcl/app.tcl", and myfile.txt and starts.
  • What comes up is the app, which the file myfile.txt is passed as argument.

 

Also see the cmdline.txt that comes with the distribution for more info.

 

Download

 

Click here to get, includes demo keystroke logger. Zip version here (rename to .zip.gz if it fails to unzip).