home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1995 November
/
PCWK1195.iso
/
inne
/
podstawy
/
dos
/
4dos
/
4uzytki
/
ez-btm11.exe
/
CH.BTM
< prev
next >
Wrap
Text File
|
1993-12-06
|
3KB
|
103 lines
: CH.BTM
: Written by Robert Chung <chung@QAL.BERKELEY.EDU>.
: **New version**, November 30, 1993
:
:begin
cdd %_disk:
if %@index[%&,/?] != -1 goto HELP
set fn=%@path[%@search[%0]]dirlist
if not exist %fn .or. %@index[%&,/s] != -1 gosub SCANDIR
*cdd %1 >&>nul ^if %_? lt 1 (unset fn^quit)
:popup dirlist if no argument
iff %#==0 then
%@word[-0, %@select[%fn%,1,40,23,70,Directory Tree]]
else
:check arg for *
iff %@index[%1,*] lt 0 then
:no asterisk
find /i "\%1" < %fn% | input %%cmdline
set cmdline=%@word[-0, %cmdline]
%cmdline
iff .%cmdline==. then
%@word[-0, %@select[%fn%,1,40,23,70,\%1 not found]]
endiff
else
:asterisk found, so trim it off the end
set argc=%@substr[%1,0,%@eval[%@len[%1]-1]]
find/i "\%argc" < %fn% | tee %fn%2 | input %%cmdline
set cmdline=%@word[-0, %cmdline]
iff %@lines[%fn%2] gt 0 then
(for %i in (@%fn%2) (echo %@word[-0, %i])) >%fn%3
%@select[%fn%3,1,40,23,70,%1]
else
%cmdline
iff .%cmdline==. then
%@word[-0, %@select[%fn%,1,40,23,70,\%argc not found]]
endiff
endiff
del /q %fn%2 %fn%3 >&> nul
unset argc
endiff
endiff
unset fn
quit
:help
text
CH [subdir[*]] [/scan] [/?]
Quickly changes subdirectory if given a partial name. If no
argument is given CH displays a selectable popup of directories.
/scan forces a rescanning of subdirectory structure.
/? displays this message.
* appended to the argument shows a popup if there is
more than one match. Otherwise, it changes to first
matching subdirectory.
Examples: ch here changes directory to d:\more\stuff\here
from c:\there.
ch st* changes to d:\more\stuff if it's the
only match, otherwise shows a popup
of d:\more\stuff, its subdirectories
if any, and other matches.
endtext
quit
:scandir
pushd
if %@index[%1,/s] = 0 shift
:The next two lines get the drives to be scanned...
set drives=C D E F G H I J K L M N O P Q R S T U V W X Y Z
set drives=%@substr[%drives,0,%@eval[1+%@index[%drives,%_lastdisk]]]
echo Saving directory list for drives (%drives%) in %fn
(for %drv in (%drives%) do (%drv:\^global /iq echo %_cwds)) > %fn%2
:relevant tree output is uppercase; use find /v to filter out lowercase
(for %drv in (%drives%) do (tree %drv:\)) | find /v "e" > %fn%3
set sp=%@char[255]%%@char[255]%%@char[255]%%@char[255]%%@char[255]%
set sp=%sp%%sp%%sp%%sp%%sp%%sp%%sp%%sp%
set j=-1
(for %i in (@%fn%3) (set j=%@eval[1+%j]^scrput %_row 0 %_fg on %_bg %@line[%fn%2,%j] %sp%^echo %i %@substr[%sp,%@len[%i]] %@line[%fn%2,%j]))>%fn
scrput %_row 0 %_fg on %_bg %sp%
del /q %fn%2 %fn%3
unset j, sp, drives
popd
return
text
Notes
HistWinColor in 4dos.ini sets color of popup.
The filename "dirlist" can be changed, but I create temporary files based
on this name (which I subsequently delete) by appending a 1 char suffix.
Gosh, I hope no one uses the environmental variable "fn" for anything
endtext