File CD.TXT - Version 3.0 Released 11/25/91 - Mike Bessy 75300,1215 ------------------------------------------------------------------ PURPOSE: This file outlines a disk navigation system for 4DOS users. REQUIREMENTS: þ 4DOS version 4.0 or later. þ at least 512 bytes of free alias space. þ at least 128 bytes of free environment space. þ MS-DOS external program FIND or equivalent. LEGALITIES: 4DOS is a shareware product of J.P. Software, Inc., PO Box 1470, East Arlington, MA 02174 (617-646-3975). This file is offered as an example of 4DOS shell programming and a demonstration of the power of 4DOS, and may be freely distributed as long as no fee is charged and its contents are not altered without JP Software's consent. No guarantee is made that the information in this file is correct, and that the various components will work as expected, even though they are constantly in use on my personal system. LIMITATIONS: Many of the "bells & whistles" may be overkill for many users, and might prove to be too slow or too inconvenient for slower or floppy-only machines. This file is meant to give users a starting point from which to build a system which meets their specific needs. HIGHLIGHTS: þ CD {directory name} goes to that directory þ CD {string} goes to the first occurrence of 'string' in the DIR file þ CD by itself returns to the previous current directory - if the search string is not found, CD beeps and echoes the current directory þ GO (or G) by itself displays all the occurrences of the last search string in a "popup windows" for easy selection þ GO (or G) {string} is equivalent to CD þ Additional keywords may be added manually to the DIR file, as in: "d:\path\foo bar here" þ The file names and locations are merely examples, and should be modified to reflect _your_ specific configuration. COMPONENTS: þ optional REFRESH.BTM batch file to automatically create the ASCII list of directories. The DIR file can also be easily created and maintained with any ASCII editor. þ aliases in a format suitable for inclusion into a file to be loaded at boot time with the "alias /r" command. USAGE: þ Load the enclosed CDD and GO aliases. þ Create an ASCII file containing the name of all the directories on your system. If you prefer, you can use the enclosed file "REFRESH.BTM" to get things started. Feel free to add, after each directory name, any keywords you may want to use later to go to that directory, such as: "d:\path\xtalk\xts scripts crosstalk" "d:\path\123 lotus wk1 þ To change directories, type CD followed by a valid directory name, if you know it, or any partial name, eg. "CD DOC". þ If the requested directory exists, 4DOS will take you there. If not, you will go to the first match found on the string you provided, eg. "C:\COMM\CSERVE\DOC". þ If the directory was not the one you wanted, you can type "GO", or "G" to "pop up" a selection window with a list of all possible matches. Use the conventional window navigation keys to select the drive and directory you want and press ENTER to go there. To cancel without changing directory, hit ESCAPE. þ If GO is invoked with an argument, it will behave exactly like CD. þ The search algorithm allows you to type "CD keyword", eg. "CD CIM" to go to the directory paired with that keyword in the DIR file ("C:\COMM\CSERVE\DOC" in the previous example) þ Either CD or GO can include other command to be executed after going to the new directory. Anything after the first argument will be processed as a command. For example, "g pc list *.log" will go to whatever drive and directory contains the string "pc" in its name or as a keyword in the DIR file ("d:\comm\procomm\pc", perhaps), and will list any file with the "log" extension there. þ Make sure you use a consistent name for the directory file. The example assumes "c:\4dos40\cdd.ini", but it can be anything you want, as long as REFRESH.BTM and aliases "CD*D" and "G*O" use the same file name. þ This scheme assumes that your directory structure is fairly static. If you often create many new directories, you may want to modify MD and RD so that they automatically maintain the directory file. The possible enhancements are too numerous to detail here. Please *experiment*! REFRESH.BTM: Notes: þ The logic assumes that you're using drive letters in alphabetical order starting with the boot drive and ending with the drive defined as "last drive" by DOS and reported by 4DOS in the "_lastdisk" variable. If your configuration differs, you may have to modify the file. þ If you invoke REFRESH.BTM with an argument( eg. "refresh c", it will assume it's a drive letter and will only process that drive, appending to any existing DIR. It is recommended that only non-removable partitions be listed. þ You _must_ change the DIR file name to something suitable for your system. REFRESH will _not_create a directory for you, and you will have to modify the "set _f" line. :------ cut everything above this line to create REFRESH.BTM ----- @echo off setlocal *set _f=C:\$DOS40\CDD.INI *echo ` ` iff exist %_f then *echo %@upper[%0] will add to existing file "%_f". else *echo %@upper[%0] will create directory file "%_f". endiff *echo ` ` *echos Hit CTRL-C to Abort now, or` ` ^ pause *set i=%1 if "%i"=="" *set i=%@char[%@ascii[%@upper[%_boot]]] :0 iff exist %i:\nul. then *echo Processing drive %@upper[%i] *cdd %i:\^global/iq *echo %_cwd>>! %_f else *echo Invalid drive: %i quit endiff *set i=%@char[%@eval[%@ascii[%i]+1]] if %i le %@upper[%_lastdisk] .and. "%1"=="" goto 0 : ------ cut everything below this line to create REFRESH.BTM ----- ALIASES: Notes: þ Each alias should be entered on a single line, but is broken down here for added legibility þ It is assumed that the default case is in effect and that the contents of the DIR file will be in lower case. If the DIR file is in upper case, replace "%@lower" with %@upper" in the CDD alias. þ The path for FIND should be adjusted for your system. Giving a full path speeds up execution significantly on many machines. þ A small temporary work file will be created in the root directory of your "TEMP" drive, or of the current drive is TEMP is not defined. If TEMP is defined, its contents are expected to contain a drive letter and colon, followed by an optional path, but no trailing backslash ("c:", "d:\temp", etc.). þ Alias "~d" is an integral part of the CDD processing and should NOT be used by itself. ;---- add the lines below to your "ALIAS /R" file ---------- CD*D=*set _cdd=%1^if "%1"=="" *set _cdd=%_cd^iff not isdir %_cdd\. then^find "%@lower[%1]"!%temp\_go^ *cdd %@word[0,%@select[%temp\_go,2,40,15,79,þ Go where? þ ]]^ *del /q %temp\_go^else^cdd %1^endiff ~D=iff "%_cdd"=="" then^beep^echo %_cwd^else^*set _cd=%_cwd^*set _go=%1^ *cdd %_cdd^%2&^endiff^*set _cdd= ; the following GX alias is a bonus for having made it this far into the file. It will "popup" a selection windows containing all the subdirectories in your current working directory. Select the one you want (including ".." for the parent directory) by using the usual navigation keys, and pressing ENTER, or hit ESCAPE to cancel. Like CD and GO, GX also accepts additional commands to be executed in the destination directory. GX=*dir/kmad>!%temp\_gx^*cdd %@word[0,%@select[%temp\_gx,2,60,15,73, þ Subdirectories þ]]>&nul^*del/q %temp\_gx ;-----cut everything below this line ----------------------- HISTORY: 1.0 02-25-91 Initially posted on CompuServe 1.1 02-28-91 Corrected REFRESH.BTM to search all drives Corrected UM alias Eliminated the CDD Syntax error message on invalid searches 1.2 03-28-91 Eliminated variable _CD 2.0 06-03-91 Greatly simplified - dropped MARKS and added ability to add commands to the CD line 2.1 06-25-91 Replaced the missing GO alias 3.0 11-25-91 Rewritten to use the 4DOS 4.0 features SUPPORT: Please post all questions and comments as public messages in the JP Software Support Section ("GO JPSOFT", Section 10). Feel free to ask for clarification of any feature (or bug!)