home *** CD-ROM | disk | FTP | other *** search
- : DES.BTM
- : A library of routines for handling 4dos descriptions and
- : DESCRIPT.ION files.
- :
- : Itamar Even-Zohar, (itamarez@plato.tau.ac.il)
- : Last edited September 5, 1992 and December 9, 1993
- :
- : Type DES for information.
- :---------------------------------------------------------------
- if "%1" == "" goto CONTENTS
- goto begin
-
- :contents
- cls
- Text
-
-
- Usage: DES function [options]
-
- where function stands for
-
- h or help <command>........... Explanations on each of the following
-
- dsc <filespecs> [>output] .... Shows filespecs with descriptions, no path
- dscp <filespecs> [>output] ... Shows filespecs with descriptions, including
- path
-
- gldsc <filespecs> ............ Globally collects specified filespecs with
- (or globdesc) their descriptions from the entire disk,
- redirecting results to an output file
-
- desc [/L|/H] ................. Finds all undescribed files and lets you
- either describe them one by one, or (with /L)
- via a batch file created by it.
-
- endtext
-
- echo.
- inkey /K"YN[ESC] [Enter]" Show more? (Y or Enter or Space | N or ESC) %%rep
- set rep=%@upper[%rep]
- iff %rep == %@char[27] .or. %rep == N then Quit
- elseiff %rep == Y .or. %rep == @28 .or. %rep == @57 then
- goto more_text
- endiff
-
- :more_text
- cls
- text
-
-
- zip-alld|zipad .............. Creates a zip archive on specified drive for
- all DESCRIPT.ION files on current disk
- desclist|deli .............. Makes a list of all DESCRIPT.ION files on
- disk, then calls list
- zip-desc|zipd .............. Creates a zip archive on specified drive for
- all DESCRIPT.ION files listed in DESCRIPT.LST
- (created by DESCLIST)
- endtext
- quit
-
- :begin
- goto %1
- quit
-
- :HELP
- :H
- call EX-HLP %2
- quit
-
- :--------------Displaying files with descriptions
- :dsc_file
- :dsc
-
- shift
-
- if .%1==. goto dsc_help
-
- setlocal
-
- :descriptions
- for %f in (%1) (
- iff not "%@descript[%f]"=="" then
- echo %f %@descript[%f]
- else
- screen %_row 0
- endiff
- )
-
- endlocal
- quit
-
- :dsc_help
- ex h dsc
- quit
- :--------------------------descriptions, with path
- :dscfp
- :dscp
- : Show filespecs with descriptions, including path
- shift
-
- for %f in (%1) (
- iff not "%@descript[%f]"=="" then
- echo %@full[%f] %@descript[%f]
- else
- screen %_row 0
- endiff
- )
- quit
-
- :-----Globally display filenames with descriptions
- :gldsc
- :globdesc
- : Globally collects specified filenames with their descriptions from
- : the entire disk and redirects results to an output file.
- shift
-
- if .%1==. goto help_gldsc
-
- pushd \
-
- setlocal
- Call settemp.btm
-
- set outfn=%temp%%0.lst
- echo Working ...
-
- (echo A list of all %@upper[%1] files on disk with their desriptions^
- echo.^
- ) >%outfn
-
- :gl
- global /iq call des dscfp %1 >&>nul >>%outfn
-
- list %outfn
- endlocal
-
- popd
- quit
-
- :help_gldsc
- ex h gldsc
- quit
-
- :----------------------Describe undescribed files
- :desc
- : == DESC.BTM
- : Finds all _undescribed_ files and lets you either (1) describe
- : them one by one, or, with the /L switch, (2) via a batch file
- : created by it for your handling. When you have edited this file,
- : running it will add all of the desired descriptions.
- : Note: Adapt the name of the editor above ^^^^^ below.
- : ====
- :----------------------
- shift
-
- setlocal
- set und=addesc.btm
- set edt=ex ed
- rem ^^^^^ this calls a sub-program in EX, calling file via selected
- rem editor. Either put your preferred editor name here, or
- rem in EX.BTM.
-
- iff exist %und then
- del /q %und
- endiff
-
- iff %@index[%1,h] ge 0 then
- goto help_desc
- endiff
-
- :desc_list
- iff (%1)==(/l) then (echo @echo off^
- echo rem ADDESC.BTM adds descriptions to undescribed files
- echo rem Put the desired description between the quotes ("").^
- echo rem Delete undesired filenames, then save & run batch^
- echo echo Adding now descriptions. Wait ...^echo echo.^echo echo on^
- echo :
- echo :begin_list^
- ) >%und
- endiff
-
- :check_desc
- for %f in (*.*) (
- iff not "%@descript[%f]"=="" then
- screen %_row 0
- else
- gosub descA
- endiff
- )
-
- iff exist %und then set ech=
- %edt %und
- goto end
- else
- set ech=echo %0 terminated
- endiff
-
- :end
- %ech
- endlocal
- quit
-
- :--(describing files one by one)----
- :descA
- iff (%1)==(/l) then echo describe %@lower[%f] "" >> %und
- return
- endiff
-
- inkey /K"YNQH" Describe %f (Y/N/Q or H[elp])? %%rep
- iff %rep == Y then
- gosub desc2
- return
- elseiff %rep == N then
- return
- elseiff %rep == H then
- goto help_desc
- elseiff %rep == Q then
- set ech=echo stopped by user
- goto end
- endiff
-
- :desc2
- screen %@eval[%_row-1] 0
- describe %f
- return
- :-------help and selecting options-----
- :help_desc
- cls
- screen 2 0
- text
- syntax:
- DESC [/L|/H]
- where
- /L = 'make list'
- /H = Help & options
-
- You can type descriptions for the undescribed files one file
- after the other, or generate a batch file for all undescribed
- files, ready for running.
- Type L for generating a list
- Type C for file by file describing
- Type Q to quit
- endtext
- screen %@eval[%_row+1] 2
- inkey /K"clq" Your choice? (C/L/Q) %%rep
- iff %rep == Q then set ech=echo stopped by user^goto end
- elseiff %rep == C then goto check_desc
- elseiff %rep == L then set 1=/l ^goto :desc_list
- endiff
-
- :--------------------Descript.ion zipped directly
- :zip-alld
- :zipad
- : Creates a ZIP archive on specified drive for all DESCRIPT.ION files on
- : current disk, using PKZIP's ability to handle hidden files.
- : No list need be pre-created, unless, of course, you wish to edit such
- : a list before archiving. In that case, use my subprogram DELI, then ZIPD.
-
- shift
- setlocal
-
- iff "%1"=="" then
- inkey On which drive create ZIP archive (type letter only)? %%1
- endiff
-
- set dri=%1
- iff %@index[%dri,:] eq 1 then
- set dri=%@substr[%dri,0,1]
- endiff
- set zbup=pkzip -ub%_lastdisk: -P
-
- pushd %_disk:\
- echo.
- echo Now creating ZIP archive for descript.ion files on drive %@upper[%dri:]
- %zbup -r -wH %dri:descript descript.ion >& nul
- gosub success
- goto last_step
- quit
-
- :---------------------------DECRIPT.ION to a list
- :DESCLIST
- :DELI
- : Note: No need to create this list if all you want is backing up
- : your decript.ion files without editing the list. Use ZIPALD
- : for directly zipping all descript.ion files.
-
- pushd c:\
- echo Creating list of DESCRIPT.ION files
- echo.
-
- setlocal
-
- :create_list
- rem Create list of all descript.Ion file, even if hidden, using a routine
- rem proposed by Robert Chung (Chung @QAL.QAL.BERKELEY.EDU) in his
- rem WHICH.BTM (4DOS command interpreter <4DOS@INDYCMS.BITNET>, 18 Jun 1992).
- rem This has made it possible to not use Ledbetter's procedure.
- :
- (for %drv in (%_disk) do (dir /sfla:h %drv:\descript.ion)) > %_disk:\descript.lst
-
- gosub Buerg
- : (check if Buerg's LIST exists)
-
- :editor?
- rem Checking if your editor / wordprocessor loaded.
- rem Here Nota Bene is checked. Change to suit your
- rem preferrence, or leave as is if you are satisfied
- rem with the alternative (Buerg's LIST, or 4DOS LIST
- rem command).
- iff %pgm=nb then
- rem ^^ change "pgm=" to your editor /wordprocessor
- gosub NBFI
- rem NBFI checks if NB file CA.RN exists. This applies only to
- rem Nota Bene users.
-
- keystack 0 "%cal %_disk:\descript.lst" enter^@exit
-
- else %list %_disk:\descript.Lst
- endiff
-
- endlocal
- popd
- quit
-
- :--------------------------Descriptions > ZIPfile
- :zip-desc
- :Zipd
- : Creates a zip archive on specified drive for all DESCRIPT.ION
- : files listed in c:\DESCRIPT.LST. The list can be created with
- :: DES DESCLIST.
- : If you have not created a list, nor wish to create one (for editing
- : before archiving), use ZIP-ALLD / ZIPAD instead of this.
- : Note: If you fail to indicate the drive, you will be asked by the program
- : to type it.
- : USAGE: DES ZIP-DESC [d[:]]
- : (meaning: typing drive, or colon are optional)
-
- shift
- setlocal
-
- iff "%1"=="" then
- inkey On which drive create ZIP archive (type letter only)? %%1
- endiff
-
- set dri=%1
- iff %@index[%dri,:] eq 1 then
- set dri=%@substr[%dri,0,1]
- endiff
- set zbup=pkzip -ub%_lastdisk: -P
-
- iff exist %_disk:\DESCRIPT.LST then
- pushd %_disk:\
- echo.
- echo Now creating ZIP archive for descript.ion files on drive %@upper[%dri:]
- %zbup -wH %dri:descript @c:\descript.Lst >& nul
- gosub success
- else
- echo.
- echo %_disk:\DESCRIPT.LST not found; Use DES DESCLIST to create it
- unset /q 1
- quit
- endiff
- endiff
-
- :last_step
- cls
- echo.
- %ech
- echo.
- dir /K /M /L %dri:descript.Zip
- popd
- endlocal
- unset /q 1
- quit
- :------sub-routine---
- :success
- iff errorlevel gt 0 .and. errorlevel lt 12 .Or. errorlevel gt 12 then
- set ech=Echo ZIP was not created
- elseIff errorlevel eq 12 then
- set ech=Echo No files to update
- else
- set ech=echo DESCRIPT.ZIP created / updated on %@upper[%dri:]
- endiff
- return
- quit
-
- :-----------------------------end of sub-programs
-
- :=================SUB-ROUTINES===================
-
- :NBFI
- iff not "%@search[CA.RN]" == "" then
- set cal=run ca.rn
- else
- set cal=ca
- endiff
- return
- :-------------------
- :Buerg
- iff not "%@alias[list]" == "" then
- unalias list
- endiff
- gosub ex_list?
- return
-
- :ex_list?
- rem Checking if Buerg's LIST exists; else registers to use
- rem 4DOS internal command ("list").
- :
- iff not "%@search[list.com]" == "" then
- set list=%@search[list.com]
- else
- set list=list
- endiff
- return
- :-------------------