home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1995 November
/
PCWK1195.iso
/
inne
/
podstawy
/
dos
/
4dos
/
4uzytki
/
ez-btm11.exe
/
EX.BTM
< prev
next >
Wrap
Text File
|
1994-05-14
|
12KB
|
507 lines
: EX.BTM
: A library of subprograms. Run with the name of any of the subprograms
: specified below + commands / options / switches. See EX-HLP.BTM (or
: type 'EX H option') for more details on each sub-program.
: (file previously called DO.BTM. Renamed EX.BTM because of clashes with
: 4DOS 5.x DO command.)
: Itamar Even-Zohar
: Porter Chair of Semiotics, Tel Aviv University
: Tel Aviv 69978, Israel
: itamarez@plato.tau.ac.il, or itiez@ccsg.tau.ac.il
:
if "%1" == "" goto CONTENTS
goto begin
:contents
cls
text
Usage: EX function [options]
where function stands for
HELP or H <command> .... Explanations on each of the following
ATB [h|s|r] .............Makes a list of files with H, S or R attributes
for default disk.
CA|ED................... Calls specified file via Nota Bene, if loaded;
else calls it (for CA) via Buerg's LIST|(for
ED) via PED
CI-HIDE {-|+} <filename> Globally unhides/hides specified files
DA|DAP ..................Puts time and full date (da=24 hours; dap=12+12)
GR|GREPFV .............. Runs GREPFV for searching strings in archives
NOCF|NOF ................Runs NOCZ.COM to strip CTRL-Z from specified file
SER|SEE|SEARCH ......... Searches a file / group of files for a string,
using SGREP, redirecting the items found to
a file called SEARCH.TMP, then calls this file
SIM .....................Calls SIMTEL20 catalogue from C: or A:
U2D|CRLF ................Adds CR+LFs to file(s) via UNIX2DOS.COM
XX <archive> <program>.. Runs program from an alternative COMLIB.ZIP file
endtext
inkey /K"YN[ESC] [Enter]" ==`>` Show more? (Y/Enter/Spacebar | N/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
ALS ....................... Reload aliases file and report
CHKP <name of pgm> ........ Check and report if a specified pgm is loaded
DUP ....................... Find doubles
SEF <string>............... Look for file(s) through list of file
descriptions and filenames
SRDX ...................... Resize dynamic ramdisk created by SRDISK
UMBMEM|UMB ................ Report how much free UMB memory left
endtext
quit
:begin
if %1 == q quit
goto %1
quit
:HELP
:H
call EX-HLP %2
quit
:------------------------------------------------------Date & time
:DA
:dap
: Puts current date and time. DA - 24 hours; DAP = 12+12
setlocal
:fullmonth
set date=%@SUBSTR[%_date,0,2]
iff %date==01 then ^ set da=January ^
elseiff %date==02 then ^ set da=February^
elseiff %date==03 then ^ set da=March^
elseiff %date==04 then ^ set da=April^
elseiff %date==05 then ^ set da=May^
elseiff %date==06 then ^ set da=June^
elseiff %date==07 then ^ set da=July^
elseiff %date==08 then ^ set da=August^
elseiff %date==09 then ^ set da=September ^
elseiff %date==10 then ^ set da=October^
elseiff %date==11 then ^ set da=November^
elseiff %date==12 then ^ set da=December^
endiff
rem -------- eliminates "0" from day's date --------
set dat=%@substr[%_date,3,2]
iff %@index[%dat,0] eq 0 then
set dat=%@substr[%_date,4,1]
goto inform
else
set dat=%@substr[%_date,3,2]
endiff^
rem --------- end of elimination procedure ---------
:inform
if .%1==.dap gosub plain_time
if %@eval[%_row] gt 22 (cls^screen 1 0)
screen %@eval[%_row] 3 %da %dat 19%@substr[%_date,6,2] -- %_time
drawbox %@eval[%_row-1] 0 %@eval[%_row+1] 35 1 whi on bla
echo.
endlocal
quit
:----------------------------------------------------Hide/Unhide
:ci-hide
@echo off
shift
iff "%1"=="" .Or. "%2"=="" then
goto syntax
:syntax
text
SYNTAX: CI-HIDE {-|+} <filename>
Globally hides /unhides specified files:
'-' = unhiding, '+' = hiding
For example:
ex CI-HIDE - DESC*.*
will unhide all DESC*.* files on the whole disk
endtext
quit
endiff
setlocal
cdd c:\
set s=s
set d=d
iff .%1==.- then
set desc=-h
elseiff .%1==.+ then
set desc=+h
endiff
iff .%desc==.-h then
set msg=Unhiding
elseiff .%desc==.+h then
set msg=Hiding
endiff
echo.
echo ==`>` %msg all %@upper[%2] files
global /Q /I attrib %desc %2 >& nul
:end
cdd -
echo.
set msg=%@substr[%msg,0,%@eval[%@LEN[%msg]-3]]den
rem (finds length of %msg, extracts last 3 charcaters, adds 'den')
echo ==`>` All %@upper[%2] files %msg
echo.
endlocal
quit
:---------------------------------------------Alternative Comlib
:XX
: Runs a pgm from an alternative zip file without extracting it
: by using Ledbetter's X.COM, a freeware which runs programs
: from a ZIP file.
: SYNTAX: EX XX alternative_comlib command
: (the ZIP extension may be ommitted)
SHIFT
iff "%1"=="" then^echo SYNTAX: EX XX alternative_comlib command / program_name^
quit^endiff
setlocal
set oldlib=%comlib
:----find out if path indicated and/or extension [zip] typed-----
iff %@index[%1,.zip] gt 0 .AND. %@index[%1,\] lt 0 then
set comlib=%_cwds%%1^goto run
elseiff %@index[%1,.zip] gt 0 .AND. %@index[%1,\] ge 0 then
set comlib=%1^goto run
elseiff %@index[%1,.zip] lt 0 .AND. %@index[%1,\] lt 0 then
set comlib=%_cwds%%1.zip^goto run
elseiff %@index[%1,.zip] lt 0 .AND. %@index[%1,\] ge 0 then
set comlib=%1.zip^goto run
endiff
:-----------------end of procedure-------------------------------
:run
: Now run the external program X.COM
x %2&
endlocal
quit
:---------------------------------------------------Call/Edit file
:CA
:ED
setlocal
gosub Buerg
iff %1==CA then^set ca=%list^elseiff %1==ED then^set CA=ped^endiff
rem (change %list in label Buerg)
rem change PED here --> ^^^
: CA - calls specified file via Nota Bene, if loaded; else uses LIST
: ED - calls specified file via Nota Bene, if loaded; else uses PED
shift
:nb
iff %pgm==nb then
gosub NBFI
rem NBFI checks if file CA.RN exists.
if .%1==. set cal=ca
keystack 0 "%cal %1" enter^@exit
else
%ca %1
endiff
endlocal
quit
:----------------------------------------------------SIMTEL20
:SIM
: Calls file SIMIBM.LST from hard disk or drive A:
shift
setlocal
set simdisk=c:\kr\sim
rem ^^^^^^^
set simfloppy=A
rem ^^^^^^^ Change locations above '^^...' strings to suit yours!
set simlist=simidx.lst
iff exist %simdisk\%simlist then
keystack 0 "\%1&" enter
list %simdisk\%simlist
quit
else
echo Insert SIMTEL20 diskette in %simfloppy:, then
pause
pushd %simfloppy:\
keystack 0 "\%1&" enter
list %simlist
popd
endiff
endlocal
quit
:--------------------------------------------------GREPFV output
:gr
:grepfv
: Uses GREPFV to search a string in archives (ARC, ZIP, LZH),
: redirect it to a file, then call the file to screen.
shift
iff "%1"=="" .or. "%1"=="?" then
ex h gr
quit
endiff
iff "%2"=="" then
echo File(s) not specified
quit
endiff
iff not exist %2 then
echo %@upper["%2"] not found
quit
endiff
:grep
setlocal
set grepfv=grepfv7
rem ^ update when relevant
call settemp.btm
set sefile=%temp%grep.tmp
iff "%@alias[ca]" == "" then
alias ca `ex ca`
endiff
%grepfv "%1" %2 %temp >%sefile
ca %sefile
endlocal
quit
:------------------------------------SGREP searched items to file
:ser
:see
:search
: Redirects items found by SGREP in specified file to
: a file called SEARCH.TMP on your temporary drive.
: If you have not defined a temporary drive, the program
: will put the file on your last drive (C:, D:, etc.)
SHIFT
iff .%2 == . then
echo USAGE
echo EX SEE item filename
echo (wildcards allowed)
quit
endiff
echo wait . . .
setlocal
call settemp.btm
set seefile=%temp%search.Tmp
iff exist %@search[EX.BTM] then
set list=ex ca
else
set list=list /w
endiff
(echo You were looking for "%1"^
echo ──────────────────────────────────────────────────────────────────────────── ^
sgrep -xfl %3 "%1" %2)>%seefile
%list %seefile
endlocal
quit
:-------------------
:dscf
shift
for %f in (%1) (
iff not "%@descript[%f]"=="" then
echo %@full[%f] %@descript[%f]
else
screen %_row 0
endiff
)
quit
:-----------------------------------------------Removes CTRL-Z
:nocf
:nof
: Removes CTRL-Z from a file, by running NOCZ.COM.
: September 6, 1992
:
: NOCZ.COM is downloadable from simtel20<msdos.txtutl>nocz12.arc
shift
if .%1==. goto help_nof
setlocal
gosub temp_file
:nocz
echo Running NOCZ. Wait ...
nocz %1 > %fn && move /q %fn %1
echo CTRL-Z removed from %@upper[%1]
endlocal
quit
:help_nof
echo Syntax:
echo %0 filename
quit
:-----------------------------------------------List of H|S|R atb
: ATB.BTM makes a list of files with H, S or R attributes from
: the whole default disk.
: Syntax: ATB [h|s|r]
: If no attribute specified, ATB will look for H (hidden files)
:
:atb
shift
setlocal
set hlist=d:\hlist
rem ^^^^^^^^ change as necessary
if exist %hlist del /q %hlist
if .%1==. set 1=h
cdd %_disk:\
if .%1==.h set lst=Hidden
if .%1==.r set lst=Read Only
if .%1==.s set lst=System
echo ==`>` Making a list of '%lst' files
global /q /i dir /klmf /a%1% >>%hlist >&> nul
*list %hlist
endlocal
quit
:-----------------------------------------------Adds CR-LF via Unix2dos
:unix2dos
:crlf
:u2d
: Adds CR-LF via UNIX2DOS.COM to file or set of files.
: (downloadable from SIMTEL20 <MSDOS.TXTUTL>, file DOS2UNIX.ZIP)
: Syntax: EX u2d filename|wildcards [@takefile]
: February 19, 1993, Itamar Even-Zohar / itiez@ccsg.tau.ac.il
:
shift
if .%1==. goto help_ud
setlocal
:1file
if %@index[%1,@] eq 0 goto takefile
echo Inserting CR-LFs. Wait ...
unix2dos %1
goto end_ud
:help_ud
echo Syntax:
echo %0 filename or %0 @filename (list file)
quit
:takefile
echo Inserting CR-LFs. Wait ...
for %f in (%1) do unix2dos %f
:count_ud
: Checks if the files exists and only then adds it to the counter.
: I would have preferred an internal errorlevel code, but none seems
: to work, so I've settled for 'if exist'.
set num=0
*for %f in (%1) do (
if exist %f (
set num=%@eval[%num+1]
)
)
:end_ud
if %_row ge 21 (pause^cls)
if %num==0 set num=No
scrput %@eval[%_row+1] 0 bri whi on bla ==`>` CR-LFs inserted to file(s)
endlocal
quit
:-----------------------Subprograms embedded in XC.BTM
:ALS
:CHKP
:DUP
:SEF
:SRDX
:UMBMEM
:UMB
call xc %1&
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
:-------------------
:plain_time
: Routine to convert 24 hours time to AM and PM time
set ti=%@substr[%_time,0,2]
if %ti gt 12 goto compute
goto low_time
:compute
if %ti=13 set ti=1
if %ti=14 set ti=2
if %ti=15 set ti=3
if %ti=16 set ti=4
if %ti=17 set ti=5
if %ti=18 set ti=6
if %ti=19 set ti=7
if %ti=20 set ti=8
if %ti=21 set ti=9
if %ti=22 set ti=10
if %ti=23 set ti=11
if %ti=24 set ti=12
set sec=%@substr[%_time,2]
set _time=%ti%%sec PM
return
:low_time
set _time=%_time AM
return
:-------------------
:temp_file
call settemp.btm
set fn=%@unique[%temp]
return
:-------------------