Text File | 1988-10-18 | 8.9 KB | 221 lines | [04] ASCII Text (0x0000)
Macro Making Hints
This file contains information for those people that want to create more complex macros than the supplied Macro Maker program can create. This file contains a list of control characters you can use in your macros. We will also take apart one of the macros supplied on the DataTerm disk to see how it works and how you can use some of the same routines in your macros.
Remember, this information is designed for writing advanced macros that can not be written with the Macro Maker program.
Following is a list of control characters that can be used in your macros. Most of these control characters will affect your display screen only. You will be using most of these control characters with the 'DISPLAY' command. The ^M <return key> will also be used with the 'XMIT' command. Control characters in a macro are represented by typing a '^' (caret - shift-6) before the letter.
Letter //e Name Function
^G - bell - Causes the Bell to beep.
^H - backspace - Moves the cursor back (to the left) one space.
^I - tab - Moves the cursor right 8 spaces (non-destructive).
^J - line feed - Causes the cursor to move straight down 1 line,
the screen will scroll if cursor is on the last line.
^K - clear EOS - (EOS = End Of Screen) Clears from the current cursor
position to the end of the screen.
^L - clear - Clears the screen and move the cursor to the home
position (upper left).
^M - return - Moves cursor to the beginning of the current line.
^V - scroll - Scrolls the display down 1 line, leaving the cursor
in the current postion.
^W - scroll-up - Scrolls the display up 1 line, leaving the cursor
in the current position.
^Z - clear line - Clears (erase) the line the cursor is positioned on.
^\ - fwd.space - Moves the cursor one space to the right.
^] - clear EOL - (EOL = End Of Line) Clears from current cursor
position to the end of the line.
We will now take apart one of the macros included on the DataTerm Disk.
This is the macro for pro-colony (you may want to print it out so you can follow along), its filename is 'DL.KEY.X' on the DataTerm disk.
# start
# - Logon Macro for pro-colony
# - set up modem
set timer 5
xmit "ATS7=50^M"
set duplex full
set baud 1200
waitfor string "ok"
This is the beginning of the macro. It begins with a label called start (# start), next there are a couple of remarks about the macro.
Next, the macro sets up the DataLink modem for the BBS we are calling.
# - display box
display "^L^J^J^M"
display "^I^I^H^H^O Calling ^J^M"
display "^I^I^H^H^O ^N^I^I^I^I^I^I ^O ^N^J^M^O"
display "^I^I^H^H^O ^N^I^I^I^I^I^I ^O ^N^J^M^O"
display "^I^I^H^H^O ^N^I^I^I^I^I^I ^O ^N^J^M^O"
display "^I^I^H^H^O ^N^I^I^I^I^I^I ^O ^N^J^M^O"
display "^I^I^H^H^O ^N^I^I^I^I^I^I ^O ^N^J^M^O"
display "^I^I^H^H^O ^N^I^I^I^I^I^I ^O ^N^J^M^O"
display "^I^I^H^H^O ^N^I^I^I^I^I^I ^O ^N^J^M^O"
display "^I^I^H^H^O ^N^I^I^I^I^I^I ^O ^N^J^M^O"
display "^I^I^H^H^O Press <esc> to quit ^J^N"
The above group of commands are making up our display box. First it clears the screen and position the cursor. Next it displays the top line of the box in inverse with the word 'Calling' in the middle. Followed by making the sides of the box with lines 3-10. The last line is set up like the first.
# window
display "^Y^J^J^J^J^M^I^I^I^I pro-colony ^J^J^M"
display "^I^I To dial Pulse type `P`, or ^J^M"
display "^I^I Any other key to dial Touch-Tone^J^M"
display "^I^I^I ^M"
display "^J^I^I^I Enter --> ^H^H^H^H^H^H^H^H^H"
This routine is designed to position the cursor inside the box that was just created to display a message. The ^H's on the last line are used to erase the text created in another section of this macro.
# - dial tone or pulse?
waitfor keyboard
if keyboard p goto pulse
if keyboard ^[ goto abort
goto tone
stop
Here we check for a keypress.
If the keypress is a 'P' then the macro goes to 'PULSE'.
If the keypress is <esc> (^[ is same as <esc>) macro goes to 'ABORT'.
If the keypress is anything else execution is passes to 'TONE'.
The macro should never get to the STOP command. If it does there is a problem in the macro. This is only there for debugging purposes and can be removed.
# - display pulse screen
# Pulse
display "^Y^J^J^J^J^J^J^M^I^I Now Dialing with Pulse ^J^M"
display "^I^I ^J^M"
display "^I^I ^J^M"
display "^I^I ^M"
display "^M^I^I^I "
# - dialing with pulse
xmit "ATDP 1 214 370 7056 ^M"
set timer 60
goto begin
This is the dialing routine set up to dial using Pulse Dialing. Note that the timer is set to 60 (seconds) to give plenty of time make connection before the macro goes to the 'abort' routine.
# - display tone screen
# Tone
display "^Y^J^J^J^J^J^J^M^I^I Now Dialing with Touch-Tone ^J^M"
display "^I^I ^J^M"
display "^I^I ^J^M"
display "^I^I ^M"
display "^M^I^I^I "
# - dialing with tone
xmit "ATDT 1 214 370 7056 ^M"
set timer 60
goto begin
stop
This is the same dialing routine set up to dial enable touch-tone dialing.
# begin
waitfor string "connect"
if failed goto restart
pause 1
display "^L"
buffer on
This is the subroutine that waits for the string 'connect' to appear, then passes control to the login sequence. Note that if the string 'connect' does not appear before the previously set number of seconds (set timer command) then control will pass to the 'restart' subroutine.
# - prompt for user name
waitfor string "login:"
xmit "datalink^M"
stop
Here the macro is waiting for the host to send the string 'login:', after which the macro sends the user name 'datalink'. This BBS has a special account set up for datalink users. At this point the macro stops and you are logged onto the BBS.
# restart
hangup
display "^Y^J^J^J^J^J^J^I^I No answer or busy ^J^M"
display "^I^I Press a key to continue ^Y"
waitfor keyboard
goto window
This is the restart subroutine that is run if connection is not made in the 'begin' subroutine before the time runs out (set timer).
# abort
display ^Y^J^J^J^J^J^J^M^I^I ^J^M"
display " You Pressed <esc>! ^J^M"
display "^I^I ^J^M"
display "^I^I Press <esc> to QUIT or ^J^M"
display "^I^I any key to continue ^Y"
waitfor keyboard
if keyboard ^[ goto exit
goto window
# exit
display "^L"
stop
This is the abort routine that is run when you press <esc>. It displays a message then upon pressing <esc> a second time it will return you to terminal mode. Pressing any other key will return you to the macro. This was written this way just in case someone pressed <esc> by mistake.
Following is the same macro but without the fancy screen formatting.
This macro is included on the front side of the disk as "sample.macro".
# start
# - Logon Macro for pro-colony
# - set up modem
set timer 5
xmit "ATS7=50^M"
set duplex full
set baud 1200
waitfor string "ok"
pause 5
# window
display "^LCalling: pro-colony ^J^J^M"
display "To dial Pulse type `P`, or ^J^M"
display "Any other key to dial Touch-Tone^J^M"
display "Enter --> "
# - dial tone or pulse?
waitfor keyboard
if keyboard p goto pulse
if keyboard ^[ goto abort
goto tone
# - display pulse screen
# Pulse
display "^MNow Dialing with Pulse^J^M"
xmit "ATDP 1 214 370 7056 ^M"
set timer 60
goto begin
# Tone
display "^MNow Dialing with Touch-Tone^J^M"
xmit "ATDT 1 214 370 7056 ^M"
set timer 60
goto begin
# begin
waitfor string "connect"
if failed goto restart
buffer on
# - prompt for user name
waitfor string "login:"
xmit "datalink^M"
stop
# restart
hangup
display "^MNo answer or busy. Press a key to continue"
waitfor keyboard
goto window
# abort
display "^MPress <esc> to quit or any other key to continue"
waitfor keyboard
if keyboard ^[ goto exit
goto window
# exit
display "^L"
stop
To get a printout of this file, you can load it into your ProDOS based word processor. Or you can use the OA-J command to view this file while enabling the online printing function with OA-O from within the DataTerm program.