home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1995 November
/
PCWK1195.iso
/
inne
/
podstawy
/
dos
/
4dos
/
4uzytki
/
4dtnt.exe
/
DO.ZIP
/
DO.DOC
< prev
Wrap
Text File
|
1991-11-03
|
7KB
|
216 lines
The key to this batch file is the labels. For example, there is a label
"homemo". There is an alias "homemo" which equals "do homemo". The first
thing DO.BTM does is branch to the label defined in its first argument.
Thus, typing "homemo" on the command line expands to "do homemo" which
causes this batch file to branch to the "homemo" label.
Having all the little batch files concentrated like this simplifies
maintenance, saves disk space (waste part of one cluster instead of many),
and allows the use of common subroutines. However, you won't find any
common subroutines in this one because it evolved from a bunch of little
batch files which were simply copied together.
@ECHO off
if k%1 == k quit
goto %1
quit
:buscor
Here's the trick from NOLTR.ZIP to find out where my business
correspondence is kept. "TO" is an alias for "pushd". "FR" is an
alias for "popd". "rsav nn" is an alias to change UltraVision text
modes and remember the existing mode. "rset" is an alias to restore
the saved UltraVision mode when done.
to business
set dr=%@substr[%_cwd,0,2]
fr
rsav 94
If the letter I'm working on doesn't exist, stack a key macro to put
in the return address and date at the top of the page; otherwise
stack a key macro to go to the present end of text (where I'm likely
to want to continue typing).
ks 0 17 "c"
if not exist %dr%\business\%2 ks 0 27 "b"
ws %dr%\business\%2
rset
cls
unset dr
Bail out of the entire batch file when done editing the letter.
quit
:homemo
This is similar to "buscor" above, but the date is used to make
a file name. This is the name the home office mainframe expects
to see when I send the memo,
set memoname=%@substr[%_date,0,2]%@substr[%_date,3,2]%@substr[%_date,6,2]
iff exist %ramd%%memoname% then
ks 0 27 "a" 17 "c"
else
ks 0 27 "a" 27 "@"
endiff
rsav 94
ws %ramd%%memoname%
rset
cls
unset memoname
quit
The following series of "pack" functions takes text files sent from
the mainframe to directory "hobuff", squashes out excess junk and
reformats them as necessary for editing later on my PC. The result
goes to directory "vsource". Again, drive letter independence is
maintained.
It makes a difference whether the source language was basic, cobol, c,
assembler, or procedure (the frame's batch language). The incoming
text format is different and the file extension is set to indicate
the language.
:packbas
:packcob
if .%2 == . quit
Find "vsource" without resorting to drive letter.
to vsource
set dr=%@substr[%_cwd,0,2]
fr
Find "hobuff" without resorting to drive letter.
to hobuff
set drh=%@substr[%_cwd,0,2]
fr
set fname=%@name[%2]
if not exist %drh%\hobuff\%fname%.asc quit
Pick up the last three letters of the command as the new file extension.
erase %dr%\vsource\%fname%.%@substr[%1,4,3]
Call a homebrew text munger to do the reformatting.
leftn 6 %drh%\hobuff\%fname%.asc %dr%\vsource\%fname%.%@substr[%1,4]
goto packup
:packasm
:packpro
:packc
to vsource
set dr=%@substr[%_cwd,0,2]
fr
to hobuff
set drh=%@substr[%_cwd,0,2]
fr
if .%2 == . quit
set fname=%@name[%2]
if not exist %drh%\hobuff\%fname%.asc quit
erase %dr%\vsource\%fname%.%@substr[%1,4,3]
A different homebrew munger for these languages.
squoze 72 %drh%\hobuff\%fname%.asc %dr%\vsource\%fname%.%@substr[%1,4]
:packup
Make sure the reformatting process made a new file before erasing
the old one.
if not exist %dr%\vsource\%fname%.%@substr[%1,4] quit
if not %@filesize[%dr%\vsource\%fname%.%@substr[%1,4,3],B] gt 0 quit
erase %drh%\hobuff\%fname%.asc
unset fname
quit
The following finds source files by name regardless of extension, in
directory vsource, regardless of drive letter and sets up the editing
operation.
The source file is copied to ramdisk for editing.
The edited result has the WordStar formatting stripped off by a filter
(filter9) and put back in the source directory.
The edited result is stripped and reformatted correctly for transmission
back to the mainframe and put in directory "hobuff".
The ramdisk copy is then erased.
A different keystroke macro is set up for each different source
language's tab and margin settings.
:vsedit
Find the source code on any drive.
to vsource
set dr=%@substr[%_cwd,0,2]
fr
Get a drive letter for hobuff.
to hobuff
set drh=%@substr[%_cwd,0,2]
fr
if .%2 == . quit
unset ext >& nul
Validate the extension. If there is no such file under any of the
expected extensions, prompt the user for the extension under which
to create a new source file.
This section also sets up the correct tab setting key macro in
variable "tabch".
Standardize case for insensitivity to same.
set ext=%@lower[%@ext[%2]]
set fname=%@name[%2]
if .%ext% ne . goto chkext
if not exist %dr%\vsource\%fname%.* goto chkext
set tabch="c"
set ext=bas
if exist %dr%\vsource\%fname%.bas goto doedit
set ext=cob
if exist %dr%\vsource\%fname%.cob goto doedit
set tabch="a"
set ext=asm
if exist %dr%\vsource\%fname%.asm goto doedit
set ext=pro
if exist %dr%\vsource\%fname%.pro goto doedit
set ext=c
if exist %dr%\vsource\%fname%.c goto doedit
unset ext
:chkext
set tabch="a"
if .%ext% == .asm .or. .%ext% == .pro .or. .%ext% == .c goto doedit
set tabch="c"
if .%ext% == .cob .or. .%ext% == .bas goto doedit
input Enter extension BAS, ASM, PRO, COB, or C %%ext
if .%ext% ne . set ext=%@lower[%ext%]
goto chkext
:doedit
if exist %dr%\vsource\%fname%.%ext% copy %dr%\vsource\%fname%.%ext% %ramd%
For any language except procedure or C, lock upper case.
if .%ext% ne .pro .and. .%ext% ne .c toggle C >& NUL
rsav 60
Keystack the right macro and run Wordstar.
ks 0 27 %tabch%
ws %ramd%%fname%.%ext%
Quit if the copy or edit operation destroyed the file.
if not exist %ramd%%fname%.%ext% quit
Strip out WS formatting for PC permanent copy.
filter9 < %ramd%%fname%.%ext% > %dr%\vsource\%fname%.%ext%
Put the latest and greatest in "hobuff" for the mainframe.
erase %drh%\hobuff\%fname >& NUL
if %tabch% == "c" rightn 6 %dr%\vsource\%fname%.%ext% %drh%\hobuff\%fname
if %tabch% == "a" filter9 < %ramd%%fname%.%ext% > %drh%\hobuff\%fname%
erase %ramd%%fname%.%ext% >& NUL
unset fname ext tabch dr drh
rset
toggle c >& NUL
cls
quit