# --+----|----+----|----+----|----+----|----+----|----+----|----+----| # ConsoleConfig.tcl - Version 1.0 - 01-October-1999 | # --+----|----+----|----+----|----+----|----+----|----+----|----+----| # Copyright (c) Hugh Dunne 1999 # This software may be freely used and distributed provided: # 1) No charge is made for this software. # 2) This copyright statement is retained. # 3) User accepts that this software is provided "AS IS" # with NO WARRANTIES WHATSOEVER, including but not limited to # merchantability, fitness for a particular purpose, and non- # infringement; and accepts SOLE LIABILITY for any consequences # whatsoever arising directly or indirectly from any use or # misuse of this software or related documentation. # 4) User agrees that the author is under no obligation to # maintain, update, modify, support or enhance this software # or related documentation. ConsoleConfig.tcl is a script written in pure Tcl for customizing the console window when running Wish on Windows. I have tested it on WinNT 4 and Windows 98. It should work on a Macintosh except for the "man pages" command. It requires Tcl 8.0 or later. I originally wrote this as a simple fix for a friend with vision problems, who found the standard console window with its Sans-serif 8-point font very hard to read. (I found it pretty annoying myself.) Of course, feature creep set in and I started adding options to change the colors and text wrap, an x-scrollbar, a shortcut menu and assorted bells and whistles. Finally I called a halt and tidied up the code a bit, and this is the result. I don't currently plan to make any more changes. This script is not intended to compete with or replace tkCon which has many more bells and whistles. You are welcome to modify your copy of the code to add your own features. HOW TO INSTALL -------------- There are a couple of different ways. 1) Save the file as wishrc.tcl in your home directory (usually C:\). It will automatically be sourced every time you start Wish. 2) If you already have a wishrc.tcl that you don't want to overwrite, save the file anywhere you like and add a line to your wishrc.tcl: source C:/wherever/you/stored/it/ConsoleConfig.tcl (Obviously you replace the above with the actual path. Note that you use forward slashes rather than backslashes. If a directory name contains a space, you must backslash the space.) 3) Alternatively just cut and paste the contents of ConsoleConfig.tcl into wishrc.tcl. HOW TO USE ---------- By default, ConsoleConfig sets your font to "Courier 10" and the background to a pale blue color. If you don't like those settings you can edit the file between the "#####" lines. Alternatively you can click on "Customize" and change the colors using the color chooser dialog. Note: "Foreground color" is the color of the Tcl output. "Background color" is the color of the console background. "stdin color" is the color of the commands you type in. "stderr color" is the color of any text output on stderr. For example type: % puts stderr "Red alert!" and you will see how it works. You can also use the font menu to change the console text widget font, and the wrap menu to control how long lines wrap in the console text widget. The options are word wrap, character wrap or no wrap. SHORTCUTS --------- If there are commands you frequently have to type in at the Wish prompt, you can add them to the shortcuts menu and then invoke them whenever you like by clicking on them. Just select "Shortcuts -> Add shortcut" and use the dialog to type in the shortcut. Click "OK" or hit to store the shortcut, or click "Reset" to clear the entry. A shortcut doesn't have to be a complete command; it can end with a curly bracket or backslash, enabling you to store partial commands and complete them by typing at the wish prompt. If you want to delete the shortcut, select "Shortcut -> Delete shortcut" and another menu pops up, listing all currently defined shortcuts. Click on the one you want to delete and it will be removed from the shortcuts menu. OTHER FEATURES -------------- The "Edit" menu has a new command: "Clear screen" which will, you guessed it, clear the screen. You can also use Control-L to clear the screen. The "Wish!" command toggles the state of the wish "dot" window. (The exclamation point indicates that this is a button, not a menu.) Click on "Wish!" (or hit Alt-W) to make the dot window go away, and again to bring it back unscathed. I don't use the dot window very much but I prefer to use Wish as a glorified Tclsh, as it's much easier to cut and paste etc. (and the tclsh window looks pretty clunky and reminiscent of the dark ages of pre-Windows DOS - not that I think Windows is the golden age or anything.) The "Help" menu also has a new command: "Man pages" which will run the Windows help program on the Tcl help file. Finally, note that clicking on the "X" button in the upper right corner of the console window (or using Alt-F4) will kill your Wish session completely, not just hide the console window. I found the default behavior very annoying because as I said above, I like to run Wish with the dot window hidden, but if the console window is gone then you have no way to get at the dot window to kill it. The result is an orphan wish process on your machine. On Windows NT you have to use the task manager to kill it, and on Windows 95/98 you have to reboot the machine. What a pain! SAVING AND RESTORING YOUR SETTINGS ---------------------------------- You can save the settings at any time by selecting "Customize -> Save settings". Your settings will then be stored in a file called wishrc.dat in your home directory. If you change the settings and exit, you will be prompted to save the settings. You can click "Cancel" if you change your mind and don't want to exit. After the settings have been saved, you can reload them at any time by selecting "Customize -> Restore settings". Pretty useful if you've been playing around with the color dialogs and end up with screaming pink text on a glaring yellow background. (Reminds me of some web pages I've seen - some people have the aesthetic sense of a box of rocks.) LIMITATIONS ----------- The wishrc.dat file must reside in your home directory. I don't think this is a big deal but you can easily throw in a tk_getOpenFile to give yourself more flexibility (e.g. to store preferences for more than one user). It doesn't seem possible to change the font of the console menubar - you still get that cheesy 8-point Sans-serif font. BUGS ---- None known. CONTACT INFO ------------ Comments, bug reports, proposals of marriage etc. to: hugh_dunne@hotmail.com