home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.wwiv.com
/
ftp.wwiv.com.zip
/
ftp.wwiv.com
/
pub
/
CEREBRUM
/
ELN321.ZIP
/
elnmacro.txt
< prev
next >
Wrap
Text File
|
1994-06-25
|
10KB
|
214 lines
ELN 3.1 Macro Facility
In ELN 3.1, macros can be recorded and played back. These macros replace
your mouse movements and keystrokes. One use for them is to have ELN
run automatically when you are not present - run ELN, specifying a macro
on the command line. The macro will load the files you want to edit,
perform the actions specified, and can exit the program.
The unregistered version can record macros but can not play them.
Keys: RECORD ctrl-alt-F8
PLAY ctrl-alt-F7
STOP ctrl-break
1.0 Recording Macros Live
The easiest way to create an ELN macro is to run ELN, press the 'Record'
keys, and perform the actions you wish to be included in the macro. Once
you have finished this, you can either press 'Record' again or 'Stop', or exit
ELN - in the latter case, the exiting will be included as part of the macro,
(the last action in the macro will be a pressing of the 'Quit' button), and
it can exit the program when played back.
The 'Record' key is Control-Alt-F8. Press this when you wish to begin
recording (you'll see a small box appear onscreen with the word "Recording",
for about a half-second), and press it again when you are finished (or use
ctrl-break). After you have finished the recording (either by pressing
'Stop' or exiting ELN), you'll be asked to specify a filename to save the
macro as. You can edit this *.MCR file with any text editor.
When recording, it's important to remember that ELN simply records the
keys pressed and mouse movements/button status. Because of this, you
must be sure that everything you do will be very predictable and the
basic events recorded can reproduce a sequence. For example, you may
normally choose a file by clicking on its name in a list-box. This should
*not* be done in a macro! Clicking on the fourth line of a list-box will
load whatever file is fourth in the directory. The next time you run
the macro, the file you thought was fourth in the directory may not be
in that position - another filename will occupy position #4 in that listbox,
and so the wrong file will be loaded, as the macro only contains instructions
to click the mouse on line 4 of the listbox.
Some general hints:
- avoid choosing items from listboxes. Something else may be in
that position when you play back next time.
- filenames should *always* be specified by typing a path name
on the first line of the FileOpen dialog box.
- to invoke the FileOpen dialog box from the network selection
list box, normally you would choose "<find file>". However,
you can't click on it and expect it to be in the same place
next time. Solution: press the 'END'key. This will always go
to the last item in the listbox, which is guaranteed to be
"<find file>" for this particular box.
- keyboard actions are safer than mouse actions
- play back macros containing mouse actions at the same screen
resolution they were recorded ("vga50=yes|no"), so that
buttons will be in their proper places.
- if you want to delete multiple tagged items after a search,
use control-D instead of D or alt-D. Control-D will delete
all marked items, but if none are marked, it does nothing.
(if you use D or alt-D instead, and a search results in no
items tagged, the currently-selected message will be deleted.
Typically, this is undesireable.)
- if the macro is meant to be run unattended, be sure that its
actions are completely predictable, that there will be no
unanticipated Yes/No question boxes. Manually editing the
file and adding a half-dozen 'KEY 27 0' lines (ESC key) will
enable the program to exit normally if something unexpected
happens.
2.0 Macro Playback
A macro must be played back from the same location (main menu, viewer,
header editor, etc), in which it was originally recorded. To load
and playback a previously-recorded macro, press Ctrl-Alt-F7, and
type its filename.
Run a macro immediately upon starting ELN by specifying its filename
on the command line, with the -m flag:
D:\BBS> eln -mMACRO1.MCR
Starting ELN normally puts you at the listbox where you can select a
network. You can start recording here, and make the file selection
process a part of the macro. A much more reliable method is to run ELN
with a filename and network number on the command line, record the macro
from the main menu (with the file loaded), and then playback in the same
manner. That is,
D:\BBS> eln DEAD.NET .0 (edit DEAD.NET in network 0)
<DEAD.NET is opened. From the main menu, press the Record keys, record
your macro, exit ELN and save the macro >
D:\BBS> eln DEAD.NET .0 -mMYMACRO.MCR
<when it is run again and you're not there, specifying the filename and
net on the command line will cause the main menu to be the place where
the macro starts running>
3.0 Macro File Format
An ELN macro file is a plain text file, with one command (followed by its
parameters) per line. It's typically easiest to create one by pressing
'Record' (ctrl-alt-F8) from within ELN, save it, and make changes with
any text editor. A sample:
; This macro must be invoked from the main menu (it was recorded starting
; at the main menu). It will load the search specification "8DAYS.ESS",
; to search for messages older than eight days, run the search, delete
; all found items, and exit ELN.
; semicolons indicate comments
; command arg1 arg2
MMOVE 40 24
; for a MMOVE (mouse movements), args are X (0-79) and Y (0-49 or 0-24)
MMOVE 30 21
MMOVE 32 21
MMOVE 33 21
; -- press the search button ('S' key) (second parameter for KEY is ignored)
KEY 's' ' '
; -- search dialog box appears. Press 'L'oad button
KEY 'l' ' '
; -- type the filename "8DAYS.ESS" into the FileOpen dialog box
KEY '8' ' ' ; comments can go at end of command lines
KEY 'd' ' '
KEY 'a' ' '
KEY 'y' ' '
KEY 's' ' '
KEY '.' ' '
KEY 'e' ' '
KEY 's' ' '
KEY 's' ' '
; -- press RETURN to indicate you're finished typing the filename.
; (user numerical value of RETURN so it isn't interpreted as end-of-line)
KEY 13 0
; -- another RETURN to close the Search Params box (Return means "OK")
KEY 13 0
; the search runs, and then we're back at the main menu.
; -- control-D to delete all marked items (see preceding section for why
; control-D must be used instead of the usual 'D' or alt-D)
KEY 4 0
; -- 'Y'es when asked if you really want to delete all marked items
KEY 'y' ' '
; -- 'Q'uit, close this packet file
KEY 'q' ' '
; -- 'Q'uit, exit the program
KEY 'q' ' '
4.0 Commands available
Most of the commands simulate a user action (mouse click, keypress). These
always have two parameters, although the second is often ignored. Parameters
can be specified either numerically, or as a character within single quotes.
KEY asciival ignored
Generates a keystroke. The first parameter is the ASCII represenation of
the key, the second param is unused. "KEY 'a' ' ' ", "KEY 13 0" (13 is
the RETURN/ENTER key), "KEY 'Q' ' ' ".
EXTKEY keycode ignored
Similar to KEY, the EXTKEY command sends a keystroke - in this case,
keys like F1, ALT-Q, INSERT, etc. The keycode parameter can be found
in some programming books as the second character generated by getch(),
following a zero. (for example, if F1 is pressed, two calls to getch()
will return zero and 59; the 59 is the value that should be on this line).
TAB ignored ignored
Send a 'TAB' keystroke. As this is handled differently than most keypresses,
'KEY' cannot be used to send a TAB. TABs are used for moving between
entry fields.
MMOVE x y
A mouse movement, with the parameters being the horizontal coordinate
(0 to 79) and the vertical coordinate (0 to 49 or 0 to 24, depending on
your VGA50 setting). A file recorded by ELN will typically have many
MMOVE's - it is safe to delete most of them. MMOVE's are only significant
if something is being dragged, such as a listbox's selection bar. At all
other times, only mouse button events are important. (It's recommended that
you delete excess MMOVE's (other than within a dragging operation) from
the file. The animation of the cursor will not be as smooth, but the macro
will be smaller and faster).
MBTNRELEASE x y
Parameters are the same as for MMOVE, and are *not* optional. A
MBTNRELEASE occurs when the user releases the mouse buttons, and must
always follow MLCLICK, MRCLICK, etc. MBTNRELEASE's are important:
buttons are triggered by the release rather than the click.
MLCLICK x y
MRCLICK x y
MLEFTRIGHT x y
Parameters are as for MBTNRELEASE. The left button, right button, or
both together (respectively) have been depressed. Any of these must
always be followed by a MBTNRELEASE. A "double-click" is defined as a
click, release, click, release, with no events in between, and all with
the same X and Y values.
The following commands do not simulate user events:
DELAY milliseconds
Pause for a number of milliseconds, then continue - useful for slowing
macro playback down for debugging. (millisecond = 1/1000 sec.)
SPEED milliseconds
Equivalent to a DELAY after *every* nondelay event. Place one SPEED
line at the beginning of a section you want to watch closely, and a
SPEED 0 at the end.