cft.tcl Description
Version:
cft - Configurable File Tool
0.82
Requirements:tcl/Tk 8.0 or above
Description:This tool will allow one to mkdir, browse, view, copy, move, delete, duplicate, rename, and convert-ascii files on Unix or Windows systems. It uses the tcl file command to perform the 'file' actions. The graphic extensions recognized are those supported by the core TK image types (.gif, .xbm, .ppm and .pgm). Book-marked directories can be saved by using the book-mark icon on the menu bar. An [X] icon on the toolbar deletes the current directory entry from the book-mark list(see Help Bookmark). The find boxes next to the Directories and Files labels allow one to quickly find directories or files by typing in some matching letters. The down arrow on the keybord allows one to continue the search if the first item found was not the item requested, and more items in the list box contained matching letters. cft can be customized to incorporate commands simply by adding them using the Configure Options menu (see Help under the Configure Options menu). cft can also be extended to open a file with a particular extension with an application of choice using the ADD - Associated File Types (see Help under the Associated File Types menu).
Navigating:The tool is driven by double-clicking on directories to cd to that directory. A single left-mouse button-click selects a file or directory. A single right-mouse button-click selects a pop-up menu with options. Selecting an option from the pop-up menu completes the operation. Double-clicking on a file opens the file in a browser, or if one of the core image types, a button is created with file's image in it.
History:cft was originally just a collection tcl proc's to help in day-to-day activities. It occurred to me that at the rate I was adding stuff to the utility, the tool would become unmanageable. I decided, for better or worse, to dump all global references into one large array (PREFS) and concentrate on a simple way of saving user-defined commands. This enabled the tool to become a little more manageable. Since I spend most of my time on Unix systems, I left in chmod, tarit, gzip, and unpackit. I also left in some handy RCS source code control commands that I use every-day.
Platforms Tested: cft has been tested on Solaris, IRIX, Linux, NT, and Windows. With some slight modifications to areas that test for tcl_platform, it could be used on Mac's and other untested platforms. Known Bugs:
Future Work:
List of Functions
Example configuration file for windows.
Sample configuration file cft running on Unix (Solaris).
Set environment variable Name: with the contents of Value: and exits from the Environment set-up menu.
Exits from the Environment set-up menu.
Help info for setting environment variables.
The Environment Variable Editing menu allows one to customize environment variables, while running cft. Common types of environment variables changes might be CLASSPATH, RCSROOT, and others. To create a new environment variable use the "NEW" button to blank-out the Name and Value entries. To temporarily set the environment variable, use the "OK" button. The "Override" button permanently saves an environment variable entry. The "Re-Set" button removes an "overriden" entry.
@see helpEnv
Convert Text File to native. (i.e. UNIX <-> Dos...If on a Unix system, remove Crtl-M from Dos files, if on Windows, add Crtl-M.
A color configuration menu that provides color control of certain widgets, or their components.
Updates, and saves color selection from color configuration menu.
Selects an RGB (8-bit) color using three slider bars for the selection red, blue, and green.
Runs any custom command up-to 15 arguments.
= 0, Run a file-associated command.
NOTE: This could be improved to access args directly.
Save file selections from listboxes, into global SEL_FILES
Parse and run command from either options, or file associations menu; Replace #_FILE_# with the currently selected file and $_UIP_# with the user input dialog entry.
= 0, Run a file-associated command.
A pop-up file selection menu that is activated when trying to locate a new command
A pop-up menu that is activated using the right-mouse-button. New "customized" buttons can be added by using the Configure Options menu and using the "ADD" button.
@see "Configure Options Help"
Due to differing screen resolutions, available fonts, etc., a test "options" pop-up menu is activated at start-up to determine the width of the options menu. The Height of a row is stored in global PREFS(OPT_H) and the width is stored in PREFS(OPT_W)
Adds a new blank entry to the options menu. The Name and Settings field must be completed to save the entry.
Removes an entry from the options menu.
Saves options after an add, delete or "OK" button was pressed.
Help information for the options menu.
Menu that allows one to associate a file with some action.
@see "Configure Options Help"Deletes entries from the "File Types" association menu.
Saves file type associations after an add, delete or "OK button
Adds a new blank entry to the file types menu. The Extension and Open With field must be completed to save the entry.
Help info for the file type association menu.
Adds your current working directory as a bookmark entry.
Removes bookmarked directory entries.
Go-to a directory from a "bookmark". If directory does not exist, remove it from "bookmark"
Get the user login id (unix-only) @reutrn users login id.
Write state information to .cft.cfg
Read-in global parameters from the configuration file.
Procedure to tag/un-tag RCS files with symbolic name.
0 = Remove RCS tag from file.
Attempt to find the end-part of the path. Assuming that you are in the 'rcsroot' or in your 'development' directory otherwise, return [pwd].
Check the RCS file for the associated symbolic name (RCS_BASE_VER)
Tag RCS file with symbolic name (RCS_BASE_VER)
Get state version from 'pwd' .rcsState.
Switch from RCS directory to current working directory and back.
If PREFS(BUILD_DIR) exists, then switch to that directory...
Loads info about RCS file activity, for current working directory.
Saves info about RCS file activity, for the current working directory. It is applied for each RCS check-out, check-in session.
Check current environment array for "name"
0 = not found.
Given a command name, search through the $path environment variable for its location.
HelpAbout pop-up menu.
Help about bookmarks.
Unpacks .zip, .Z, .gz (on unix-only)
Up button; 64-bit encoded gif file.
Remove "bookmark"; 64-bit encoded gif file.
Down button; 64-bit encoded gif file.
Right button; 64-bit encoded gif file.
hiloaz: File sort a-z, hi->lo; 64-bit encoded gif file.
Date sort hi->low; 64-bit encoded gif file.
File size sort, hi->lo; 64-bit encoded gif file.
File sort a-z, lo->hi; 64-bit encoded gif file.
Date sort lo->hi; 64-bit encoded gif file.
File size lo->hi; 64-bit encoded gif file.
Refresh; 64-bit encoded gif file.
home; 64-bit encoded gif file.
dev; 64-bit encoded gif file.
mirror; 64-bit encoded gif file.
build; 64-bit encoded gif file.
cut; 64-bit encoded gif file.
copy; 64-bit encoded gif file.
paste; 64-bit encoded gif file.
rename; 64-bit encoded gif file.
mkdir; 64-bit encoded gif file.
convert; 64-bit encoded gif file.
help; 64-bit encoded gif file.
help; 64-bit encoded gif file.
delete; 64-bit encoded gif file.
duplicate; 64-bit encoded gif file.
browse; 64-bit encoded gif file.
search; 64-bit encoded gif file.
next; 64-bit encoded gif file.
prev; 64-bit encoded gif file.
Tars-up a list files (unix-only)
Tar and compress files (unix-only)
If a single file is selected, then the .Z or .gz file takes on the name of the file selected.
If multiple files are selected, then "doIt type" is called to get the name of the .Z or .gz file and tarit is called a second time "count = 1" to indecate that a PREFS(TAR_FILE_NAME) has been entered.
Multiple file flow:Pop-up menu with buttons generated from user-defined options.
Being a separate proc, this allows one to reset HOME env, while cft is running.
Process file selection...
Get cursor's x y position as it it is moving for listbox selection.
Get marked cursor's x y position for listbox selection.
Clear selections, and set selection to nearest y listbox location.
Clear selections, and set all associaed file widgets to the given index.
Set selections to nearest y listbox location.
cfg Main widget that displays files and directories. Window manager configurations
Function to get available disk-space. NOTE: Currently a stubb function.
Procedure to set brwose widget to line-number
Find an item in a text widget.
Find next or previous search item.
This procedure attempts to compute the current line-number while scrolling
Help browse file.
Displays either a file or global PREFS(DATA).
Displays the output from the df program (unix-only)
Compare "a" with "b" and return a 0 or 1.
Compare "a" with "b" and return a 0 or 1.
Re-set image count and destroy image widget.
Display thumb-nailed sized images on a scrolling canvas widget.
Make thumb-nail images and put them on a scrolling canvas widget.
Hilite all instances of "Search for"" in a text widget.
Hilite all instances of "Search for"" in the selected file.
Return a file date in a displayable format
Change directory to the level above.
Return (lower-case) file extension.
General purpose message pop-up dialog.
scrolls multiple list-boxes.
Update list-boxes with current directory info.
Update list-boxes with current file info. global PREFS
Procedure rcs-diff using tkdiff.
Checkout(unlocked) a temporary copy of the RCS ,v files to be browsed.
View the output from the RCS rlog command.
Cycle through all selected files and perform "tkdiff" on each against the RCS repository.
Get an unlocked copy (latest version) of a file in the RCS repository.
Unlock the latest copy checked-out
Get user's check-in message and issue the check-in commad if "OK" is selected.
Create new RCS managed file(s)
Check-in RCS managed files.
Lock RCS managed files without getting a copy from the repository.
Check-out RCS managed files
Clear out message area
Set a message
Set an error message
Procedure to display differences between two text files.
Remove files and directories
Pop-up dialog to get arguments for chmod, and mkdir, RCSROOT, etc.
Parse the output from the doit_test pop-up dialog, combine static user defined commands and call runCmd.
= 0, Run a file-associated command.
This pop-up dialog appears when User Input Parameters #_UIP_# is in the command string PREFS(_X).
= 0, Run a file-associated command.
(unix-only) runs xwd command.
(unix-only) Pop-up dialog to get the name of the xwd file, waits 5 seconds and runs getScreenShot.
Pop-up dialog to get new file name for file rename. It also checks to prevent rename - that will delete an existing file.
Procedure to rename a file.
(unix-only) procedure to change file permissions.
Uses the tcl file command to make a new directory.
Sets RCS_BASE_VER variable and saves current state.
Sets DEVELOPMENT_DIR variable and saves current state.
Sets BUILD_DIR variable and saves current state.
Sets RCSROOT variable and saves current state.
Saves items selected from the listbox for a later "paste" operation.
"move" or "copy" files saved in the copy or cut sequence. Uses the tcl file command to "copy" or "rename".
Set file sort method.
dn = file date min-> max.
fm = file name max-> min.
fn = file name min-> max.
sm = file size max-> min.
sn = file size min-> max.
Calculate a toplevel's window's relative position to its parent or some other window.
e.g. Place new toplevel .foo on top of the main window '.' offset 30 pixels in x and y. . .foo 30 30
Create a button and display an image on it.
Make thumbnail images out of the originals.