home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1995 November
/
PCWK1195.iso
/
inne
/
podstawy
/
dos
/
4dos
/
4uzytki
/
ez-btm11.exe
/
XC.BTM
< prev
Wrap
Text File
|
1994-10-26
|
7KB
|
259 lines
: XC.BTM
: A library of sub-programs. Run with the name of any of the sub-programs
: specified below + commands / options / switches. See XC-HLP.BTM (or
: type 'XC H [option]') for more details on each sub-program. All of
: the programs included here can also run from EX.BTM. This frees you
: from remembering which sub-program is stored where. XC.BTM is however
: required by EX.BTM because the programs run by the 'call' command.
:
: Itamar Even-Zohar
: Porter Chair of Semiotics, Tel Aviv University
: Tel Aviv 69978, Israel
: e-mail: itamarez@plato.tau.ac.il
:
if "%1" == "" goto CONTENTS
call settemp.btm
:: (sets temp drive for programs)
goto begin
:contents
cls
text
Usage: XC function [options]
where function stands for
help or h <command>........ Explanations on each of the following
DUP ....................... Find doubles
ALS ....................... Reload aliases file and report
UMBMEM|UMB ................ Report how much free UMB memory left
CHKP <name of pgm> ........ Check and report if a specified pgm is loaded
SEF <string>............... Look for file(s) through list of file
descriptions and filenames
SRDX ...................... Resize dynamic ramdisk created by SRDISK
endtext
screen 19 1
:select
inkey /K"[ESC][Enter]" ==> Type ENTER for more, ESC to quit %%rsp
if %rsp == @28 goto more_text
if %rsp == %@char[27] (unset rsp^quit)
:more_text
cls
text
(nothing here) ............. Vacant for future sub-programs
endtext
inkey /K"[ESC][Enter]" ==> Type ENTER to return, ESC to quit %%rsp
if %rsp == @28 goto contents
if %rsp == %@char[27] (unset rsp^quit)
:begin
if %1 == q quit
goto %1
quit
:HELP
:H
call XC-HLP %2&
quit
:------------------------------------------------------Doubles
:DUP
rem Finds out if Ledbetter's program is found on your path.
iff "%@search[whereis.exe]" =="" .and. "%@search[SST.exe]" =="" then
echo.
echo You need Ledbetter's SST (formerly WHEREIS) to run this sub-program
quit
endiff
set exceptions=-x*.set -x*.kbd -xnb*.* -x*.ov* -xdes*.* -xfilelist -xstart*.*
REM -- Modify the exclusion list to suit your needs.
echo Scanning disk for duplicates . Wait ...
whereis *.* -dup %exceptions >%temp%doubles.lst
ex ca %temp%doubles.lst
endiff
quit
:----------------------------------------------loading aliases
:qic
:als
set as_file=c:\qicurim
rem ^^^^^^^^^^ (change as needed)
if not exist %as_file INPUT Program needs the name of your aliases file (include path): %%as_file
if not exist %as_file (echo %@upper["%as_file"] not found^goto end_als)
alias /R %as_file
if %@eval[%_row] ge 22 cls
echo ALIAS file reloaded. Here is current state:
screen %@eval[%_row-1] 0
call xc al
:end_als
unset as_file
quit
:-----------------------------------------Reporting alias memory
:aliases
:al
setlocal
rem [writing to ramdisk; if not defined, writing to default disk]
set fn=%@unique[%temp]
find /i "alias" %@search[4dos.ini]>%fn
set lines=%@lines[%fn]
set num=1
:check_lines
:: (checking line one by one until exact match found)
if %num gt %lines goto analyse
set line=%@line[%fn,%num]
set walias=%@word[0,%line]
iff .%walias==.alias then
set sn=%line
else
set num=%@eval[%num+1]
goto check_lines
endiff
:analyse
:: (the number is found out from the line)
set po=%@eval[%@index[%sn,=]+1]
set total=%@substr[%sn,%po]
if %@eval[%_row] ge 22 cls
screen %@eval[%_row+1] 0 Total memory allotted to aliases:
iff %@eval[%total] lt 1000 then
screen %@eval[%_row] 36 %total bytes
else
screen %@eval[%_row] 35 %total bytes
endiff
screen %@eval[%_row+1] 0 Free memory for aliases:
iff %@eval[%_alias] lt 1000 then
screen %@eval[%_row] 36 %_alias bytes
else
screen %@eval[%_row] 35 %_alias bytes
endiff
del /q %fn
endlocal
quit
:-------------------------------------Checks if a program loaded
:CHKP
: Checks and reports if a specified pgm is loaded.
: The procedure is based on MS-DOS mem /m, redirected to a unique-
: file (on ramdrive, is accessible). If a program ("module") is
: not loaded MS-DOS creates 1 line; otherwise, it creates a text
: with several lines. This procedure simply counts the number of
: lines for deducing whether a program is loaded or not.
shift
if .%1==. goto syntax
set umbm=%@unique[%temp]
mem /m %1 > %umbm
iff %@lines[%umbm] lt 2 then
rem if %_batch ge 2 set loaded=0
echo ==> Program %@upper["%1"] is not loaded (or error in name)
goto quit
else
rem if %_batch ge 2 set loaded=1
echo ==> Program %@upper["%1"] is loaded
goto quit
endiff
:quit
del /q %umbm
unset umbm
quit
:syntax
echo Syntax is:
echo %0 name_of_program
quit
:
: Comment: the idea was to be able to use this procedure for determining,
: also in AUTOEXEC.BAT, whether a certain pgm is loaded. This can be helpful
: in determining the type of computer. No msg is needed therefore if this
: procedure is run as an auxiliary procedure from another batch file.
: ---------------------------------------------REPORTS free UMB
:UMBMEM
:UMB
:: Reports how much free UMB memory left
set umbm=%@unique[%temp]
mem > %umbm
set umbmem=%@word[3,%@line[%umbm,4]]
rem (gets the 4th word from the 5th line)
set umbmem=%@substr[%umbmem,0,%@eval[%@LEN[%umbmem]-1]]
rem (gets the number without the last letter)
del /q %umbm
echo Upper Memory has %umbmem%K free
unset umbm umbmem
quit
:---------------------------------------------Look for file(s)
:sef
: Looks for files by any segment of their name and description
: in a file called FILELIST created by this batch. If /l switch
: used, creates file on temporary drive, else calls results via LIST /S.
if "%1"=="" (echo Syntax: SEF search_item^quit)
shift
dir > filelist
iff "%2"=="" then
find /i "%1" filelist | list /s
else
call settemp
find /i "%1" filelist > %temp%sef.lst
echo Results redirected to %temp%sef.lst
gosub callfile
endiff
quit
:callfile
inkey /K"YN" Call %@upper[%temp%sef.lst] to screen ( Y/N ) ? %%rep
if %rep == Y (ca %temp%sef.lst)
if %rep == N return
return
:-----------------------------------------------Runs SRDISK--
:SRDX
: Helps resizing ramdisk created with SRDISK. SRDISK has more
: parameters. Type SRDISK /? for more help.
: SRDISK is downloadable from simtel20 as srdsk205.zip (msdos/ramdisk)
setlocal
set fn=%@unique[%temp]
srdisk >%fn
echo Current ram%@trim[%@line[%fn,5]]
echo (%@trim[%@line[%fn,10]]K)
input Type new desired size (in kbytes): %%newsize
iff .%newsize == . then
echo SRDISK aborted
goto quitsrd
else
srdisk %newsize
endiff
:quitsrd
del /q %fn
endlocal
quit
:----------------------------------------------...............
:----------------------------------------------...............
:----------------------------------------------...............