|
IzhNews #0D
28 февраля 2003 |
|
IS-DOS - The macros in the IS-DOS.

Macros in the IS-DOS.
"Catch the wind with all sails!
.."
"Well, if I then decided,
then necessarily drink ... "
Vladimir
Vysotsky
(C) Sergey Kolesnikov (SKL-KEEPER)
IS-DOSe I work for a long time - as much as
five years - and that is called, the dog ate
in this case. But macros interested and began to apply them
only recently. This stems from the lack of information: helrah
of them referred to as a surfactant, imprecise, and who could
know that their can be used to greatly ease the
life, authorizing the execution of a computer-intensive work?
Just keep in mind that work with text files in the IS-DOSe
makes sense only in the electronic drive
otherwise benefit from the Editor
come to naught.
Let's start with what are called macros
the text editor by pressing "EXTEND
MODE ". At the top of the screen will
the word "MAC". After that, the program will
wait for keypress, calling the macro.
The file must be EDITed_mac.txt
the actions which should produce a macro, and this description
should begin with, his calling.
Well, here's a concrete example: You're
great deal of correspondence and some of the words most
frequently used, you can assign to macros and invoke them by
pressing only two keys - EXTEND MODE and another key. Here's
how:
zZdravstvuy,
dDo bye
sSPECTRUM
In the first example, after calling the macro
and pressing the "z" the computer will write from a position
cursor to the word "Hello" in the second -
the word "bye" in the third - SPECTRUM.
Only we must bear in mind that the characters
the line should be less than 32 (namely
so much is put into the buffer driver). If
need to write lengthy text
Macros can be attributed to the chain, causing a
end of the first following example:
1Spektrumisty, # 0E2
2obedinyaytes!
Code # 0E just serves to close
makrosnyh lines. After him, we only
indicate what the line "bind" to the caller. A chain of macros
can be close and itself to itself, ie if you write a
Macro:
1SPECTRUM # 0E1,
the program will continuously print
SPECTRUM, until you hit the space bar.
That "space" and serves to interrupt
chain macros. Can also be as
tag end of the chain using an empty
row - the symbol "T" on the Latin prefix
SS / SPACE (code # 12).
We should also mention the combination of # R
(Repeat) - repeater. After it should
stand two figures, the first of which - the number of
repetitions, the second - the length of the repeated plot.
Example:
# R38SPECTRUM - this macro prints
SPECTRUM word three times (8 letters).
# R51 # 0A - and this will move the cursor to the
five rows down.
In my practice, using a macro to
print "title" of the letter (on another -
corner of the stamp), here's the text:
1.dw1 (a) SKL-KEEPER.dw0.ds1 # 0D # 0E @
@ Aka Kolesnikov # 0D # 0Esh
w Mihaylovich.ds0 # 0D # 0D # 0Esch
sch355042, Stavropol, # 0D # 0E
ul.Dovatortsev 53/2-8 # 0D # 0D # 0Et
ttel. (8652) 77-55-95 # 0D # 0Eyu
th 18.00-22.00 MSC # 0D # 0D # 0Ez
z # R92 Hello, # 20
And now, a detailed explanation. Macro
called by pressing the "1" (after EXTEND MODE, of course). .
Dw1,. Dw0,. Ds1,. Ds0 - A printer control codes, allowing
printing with different fonts, I have not dwell. After printing
the first line in the end it is the code # 0D, that equivalent
to clicking "ENTER", ie the next line will print a new line.
Hereinafter called the line with "@" symbol, printed, again,
quit, and invoked following the symbol "N". After
it - double-newline and the next challenge for the symbol "u",
and so on. The last line tells the macro program what to nine
times to print two spaces, then the words "Hello," and print a
single space.
Using macros you can give the editor a specific task.
Consider some of them. For example, changing the editor, such
as the length of the string Format:
3 # 12pr31 # 0Ds; 31 characters per line
4 # 12pr41 # 0Ds; 41 - "5 # 12pr42 # 0Ds; 42 -" 6 # 12pr62 #
0Ds; 62 - "7 # 12pr75 # 0Ds; 75 -"
Causing the macro under the symbol "3", we
specify the program that you need to call the main prefix (SS /
SPACE), code is # 12, then call the function "p"
- Setting Editor, set the right border formatting "r"
equal to 31 characters, press "ENTER, and record the
performance of this business function" s " (SAVE) in the file
edit.com. As you can see all very simple: alternately indicate
that to do the program, and all!
And write macros are not as difficult as it seems at first
glance. Just at first, do you set yourself the task of manually
writing at the same time, press any key, and then decorate it
all as a macro.
For reference, here are some key codes
that you may find useful:
Key Code Function
CS / January 2007 RUS / LAT
CS / February 6 BIG / small
CS / March 2004 Ins / ovr
CS / April 2005 Home
CS / May 2008 Left
CS / 6 0A Down
CS / 7 0B Up
CS / August 2009 Right
CS / 9 0F End
CS / 0 0C Delete
ENTER 0D
SPACE 20
CS / SS 0E Macro
SS / Q 15 Page UP
SS / A 10 Page DOWN
SS / ENTER 1911 Prefix
SS / SPACE 12 Prefix
SS / W 13 Erase
SS / E 1914 Insert
CS / SPACE 1916
CS / ENTER 1917
Just keep in mind that zero to tens of writing a must!
Have gone further.
Let me tell you about the specific case of
my practice. The fact that I svapper,
My directory was compiled gradually over many years and now
reaches 460 sectors, or about 120 kB. But I made error, and the
demos I had not in a separate section, and interspersed with
games ... Inconvenient, I agree! I faced the problem sort of
game demos, zanesya them separate section. Task a little easier
by the fact that the title of the demos I wrote DEMOMUSIC
(otherwise how would I featured demos from the games?). I keep
putting off sorting, because Manually it would take too a lot
of time and that I afford not to could :-). So, when I began to
learn macros, I thought: "Why not entrust all this work to
them? "
How could compose a text macro? Well,
let's order. First of all, we have
overlay to give the job search, we're going to sort (recall
that the hallmark of the demos - this is a record in the same
line, the words DEMOMUSIC, and in games of this the word no).
Overlay search (and replace, by the way) is called by
pressing "F" on the main prefix (SS / SPACE). Going into this
overlay, we give shape models - "DEMOMUSIC", then go
from it. This model is now in the buffer overlay.
What would we do if we had
do the job manually? First we go to the main prefix SS / SPACE
code # 12 (See table above), then just in case
moves to the beginning of the file, ie press
"T", then again get into the main prefix
and press the "f" to search for models in the text,
then "n" (search for the next model.) Search starts, the
computer will find a string in which is the word "DEMOMUSIC",
then we will need to exit this mode by pressing
space, again enter into the main prefix
fix it with a space, erase the line "d" (delete), move to the
end file and restore the erased line by pressing the "u"
(undelete). And finally, get of a prefix by pressing space. We
make this cyclical program, otherwise it will
one line, will bring it to the end of the file and
stop. And it can be done by closing
this chain itself to a code # 0E. Ultimately that's what we've
got (A macro is invoked by pressing the digit "2"):
2 # 12t # 12fn # 12 dbu # 0E2
The result of his work will be a
section with a line containing the word "DEMOMUSIC". Wait, why
do we need a section in every line of which is that word?
This is not the rules :-) We are better this obzovem
the most part "demo" or something in this
kind, and the word DEMOMUSIC remove, but not
hand and not even a separate macro, and
better to let the same macro in the course of their work also
deletes the word! And to to do this, we need only a little to
improve an already created macros us. But first need to be at
the beginning of his work, when we ask the model set yet change
(by pressing the "M") in the form of nine gaps (number of
letters in the word DEMOMUSIC). Refinement of macro would be
only adding three operations: after how complex restored the
previously found and erased the line, we will need to enter
again in the overlay search and replace ("f"),
"Click" "n" (search for the next model)
program, of course, "find" the same
most line on which the cursor and
we are using mode "S" (S / Cs) will produce
substitution model was found nine gaps! Now the macro will take
the final form:
2 # 12t # 12fn # 12 dbufnS # 0E2
Let me explain just why in front # 0E2 appeared two spaces:
the first - Exits search and replace, the second - the removal
of fixation macro.
Well, as you see, it's not so difficult to
:-) You want us to task, we decided.
Now let's try to solve the puzzle more complicated: what if
we need to make a simple sample program from a directory on
some grounds, without washing them? In Basically, you can use
the above method, then maintaining that we found, and the
source directory to delete (on a floppy disk, it still
remains). But we can address this issue and using a macro,
however, the work he will be greatly
longer than that considered above. Witty
idea for solving this problem proposed Krasnodar e-zine
"Odyssey" (Now deceased :-().
So, what are our actions? Load in
editor of the catalog file. Call the main
prefix SS / SPACE, and then overlay the search and
replacing "f", we introduce a model for the search and replace,
equal to model (!) Total number of characters "@" sign (you and
others icons, but preferably less often used). Press SPACE, go
to the top File (# 12t), call the search and overlay
replace (# 12f) and do a global replacement
model in the whole file to that change, that we
introduced earlier ("g"). Then change the model and
change places, that is putting
"0" and exit the overlay code # 10:
a # 12t # 12fg0 # 10 # 0Eb
The macro is invoked by pressing "a", and
end of line invoke the second line. It
to verify the completion of the macro check empty string ("T"),
again call overlay search and replace, and give
he set to find the first model in the text, because, by doing a
global replacement, we returned to the point of entry into the
editor, ie in beginning of the file:
b # 12T # 12fn
Remove overlay SS / A and causing the overlay
block operations, marking the line where
cursor:
b # 12T # 12fn # 10 # 11mm
We leave at the end of the file and then use the code # 0E
to call the next line macro according to the letter "c", we get:
b # 12t "12fn # 10 # 11mm # 12b # 0Ec
Go back to the overlay block operations, call the copy,
remove mark and invoke the following line:
c # 11c # 10 # 11o # 0Ee
But the following two lines of the macro to perform more
complex functions. First, called the letter "e", runs the
overlay Find and Replace, which searches for the first model
from the end of the file, and because it's - we copied
tolkochto row, then, of course, she is chosen. Then overlay
produces the inverse operation, returning the previous model
and removing introduced in the first line of the macro
replacement. Then remove the overlay and return to the top of
the file:
e # 12fp # 53 # 10 # 12t # 0Ef
The last line, called the letter
"F", again starts the overlay search
and replacement, looking for the first model from the beginning
file and produces the same as the previous
string operation, ie exchange and replacement model, returning
its initial value.
Remove the overlay and loops created
macro to a string of letter "b", because first
We need only once.
f # 12fn # 53 # 10 # 0Eb
In the end, that's what we got:
a # 12t # 12fg0 # 10 # 0Eb
b # 12t # 12fn # 10 # 11mm # 12b # 0Ec
c # 11c # 10 # 11o # 0Ee
e # 12fp # 53 # 10 # 12t # 0Ef
f # 12fn # 53 # 10 # 0Eb
Try it, it works fine! And you are
this time, go drink of tea or a smoke in the house (smoking is
bad :-)).
And finally, another macro that, firstly, would you even more
understand this fact, and secondly, it has practical value in
the work.
Sometimes it is necessary to divide the text
pages, especially if the text is
tables and do not want to, for example,
Cap it was on the same page, and the rest - on the other.
On a standard sheet of A4 paper
fits 62 lines of text, if printed in half the interval. Let's
write a macro that will break our text on pages,
and we call it, for example, the letter
"R".
So, first of all must go
in nachako file, because Suddenly you need
divided into wet-page file? Then go to the second line of the
macro that is called the symbol "<", where three times to move
the cursor down the page (which is three times with 20 rows)
and two more times by one line. Now re-call prefix SS / SPACE
and place an asterisk separator pages "l".
Process to continue, stuck with this
string macro itself, and the first
line, we need only once at the beginning of the macro. Here's
what happened in the end:
r # 12t # 0E <
<# R31 # 10 # 0A # 0A # 12l # 0E <
And finally - the shortest macro, which enables you to print
date:
d # D
I hope that at boot you have
included in the autoexec.bat line call
date.com and at the beginning of the set date. That is the date
and print!
Other articles:
Similar articles:
В этот день... 7 December