home *** CD-ROM | disk | FTP | other *** search
/ Set of Apple II Hard Drive Images / hard.hdv / HARD / DATATERM / MACRO.HINTS < prev    next >
Encoding:
Text File  |  1988-10-18  |  8.9 KB  |  221 lines  |  [04] ASCII Text (0x0000)

  1. Macro Making Hints
  2.  
  3. 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.
  4.  
  5. Remember, this information is designed for writing advanced macros that can not be written with the Macro Maker program.
  6.  
  7. 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.
  8.  
  9.  
  10.  
  11.   Letter   //e Name      Function
  12.    ^G   -   bell       - Causes the Bell to beep.
  13.    ^H   -   backspace  - Moves the cursor back (to the left) one space.
  14.    ^I   -   tab        - Moves the cursor right 8 spaces (non-destructive).
  15.    ^J   -   line feed  - Causes the cursor to move straight down 1 line,
  16.                          the screen will scroll if cursor is on the last line.
  17.    ^K   -   clear EOS  - (EOS = End Of Screen) Clears from the current cursor 
  18.                          position to the end of the screen.
  19.    ^L   -   clear      - Clears the screen and move the cursor to the home 
  20.                          position (upper left).
  21.    ^M   -   return     - Moves cursor to the beginning of the current line.
  22.    ^V   -   scroll     - Scrolls the display down 1 line, leaving the cursor 
  23.                          in the current postion.
  24.    ^W   -   scroll-up  - Scrolls the display up 1 line, leaving the cursor 
  25.                          in the current position.
  26.    ^Z   -   clear line - Clears (erase) the line the cursor is positioned on.
  27.    ^\   -   fwd.space  - Moves the cursor one space to the right. 
  28.    ^]   -   clear EOL  - (EOL = End Of Line) Clears from current cursor
  29.                          position to the end of the line.
  30.  
  31. We will now take apart one of the macros included on the DataTerm Disk.
  32. 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.
  33.  
  34.  
  35.    # start
  36.    # -  Logon Macro for pro-colony
  37.    # - set up modem
  38.    set timer 5
  39.    xmit "ATS7=50^M"
  40.    set duplex full
  41.    set baud 1200
  42.    waitfor string "ok"
  43.  
  44. 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.
  45. Next, the macro sets up the DataLink modem for the BBS we are calling.
  46.  
  47.  
  48.    # - display box 
  49.    display "^L^J^J^M"
  50.    display "^I^I^H^H^O                     Calling                     ^J^M"
  51.    display "^I^I^H^H^O  ^N^I^I^I^I^I^I ^O  ^N^J^M^O"
  52.    display "^I^I^H^H^O  ^N^I^I^I^I^I^I ^O  ^N^J^M^O"
  53.    display "^I^I^H^H^O  ^N^I^I^I^I^I^I ^O  ^N^J^M^O"
  54.    display "^I^I^H^H^O  ^N^I^I^I^I^I^I ^O  ^N^J^M^O"
  55.    display "^I^I^H^H^O  ^N^I^I^I^I^I^I ^O  ^N^J^M^O"
  56.    display "^I^I^H^H^O  ^N^I^I^I^I^I^I ^O  ^N^J^M^O"
  57.    display "^I^I^H^H^O  ^N^I^I^I^I^I^I ^O  ^N^J^M^O"
  58.    display "^I^I^H^H^O  ^N^I^I^I^I^I^I ^O  ^N^J^M^O"
  59.    display "^I^I^H^H^O               Press <esc> to quit               ^J^N"
  60.  
  61. 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.
  62.  
  63.    # window
  64.    display "^Y^J^J^J^J^M^I^I^I^I   pro-colony ^J^J^M"
  65.    display "^I^I           To dial Pulse type `P`, or ^J^M"
  66.    display "^I^I        Any other key to dial Touch-Tone^J^M"
  67.    display "^I^I^I                              ^M"
  68.    display "^J^I^I^I      Enter -->           ^H^H^H^H^H^H^H^H^H"
  69.  
  70. 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.
  71.  
  72.    # - dial tone or pulse?
  73.    waitfor keyboard
  74.    if keyboard p goto pulse
  75.    if keyboard ^[ goto abort
  76.    goto tone
  77.    stop
  78.  
  79. Here we check for a keypress.  
  80. If the keypress is a 'P' then the macro goes to 'PULSE'.
  81. If the keypress is <esc> (^[ is same as <esc>) macro goes to 'ABORT'.
  82. If the keypress is anything else execution is passes to 'TONE'.
  83. 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.
  84.  
  85.    # - display pulse screen
  86.    # Pulse
  87.    display "^Y^J^J^J^J^J^J^M^I^I            Now Dialing with Pulse      ^J^M"
  88.    display                 "^I^I                                        ^J^M"
  89.    display                 "^I^I                                        ^J^M"
  90.    display                 "^I^I                                          ^M"
  91.    display "^M^I^I^I      "
  92.    # - dialing with pulse
  93.    xmit "ATDP 1 214 370 7056 ^M"
  94.    set timer 60
  95.    goto begin
  96.  
  97. 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.  
  98.  
  99.    # - display tone screen
  100.    # Tone
  101.    display "^Y^J^J^J^J^J^J^M^I^I        Now Dialing with Touch-Tone     ^J^M"
  102.    display                 "^I^I                                        ^J^M"
  103.    display                 "^I^I                                        ^J^M"
  104.    display                 "^I^I                                          ^M"
  105.    display "^M^I^I^I      "
  106.    # - dialing with tone
  107.    xmit "ATDT 1 214 370 7056 ^M"
  108.    set timer 60
  109.    goto begin
  110.    stop
  111.  
  112. This is the same dialing routine set up to dial enable touch-tone dialing.
  113.  
  114.    # begin
  115.    waitfor string "connect"
  116.    if failed goto restart
  117.    pause 1
  118.    display "^L"
  119.    buffer on
  120.  
  121. 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.
  122.  
  123.    # - prompt for user name
  124.    waitfor string "login:"
  125.    xmit "datalink^M"
  126.    stop
  127.  
  128. 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.
  129.  
  130.    # restart
  131.    hangup
  132.    display "^Y^J^J^J^J^J^J^I^I               No answer or busy          ^J^M"
  133.    display               "^I^I            Press a key to continue      ^Y"
  134.    waitfor keyboard
  135.    goto window
  136.  
  137. This is the restart subroutine that is run if connection is not made in the 'begin' subroutine before the time runs out (set timer). 
  138.  
  139.    # abort
  140.    display ^Y^J^J^J^J^J^J^M^I^I                                         ^J^M"
  141.    display                    "              You Pressed <esc>!         ^J^M"
  142.    display                "^I^I                                         ^J^M"
  143.    display                "^I^I            Press <esc> to QUIT or       ^J^M"
  144.    display                "^I^I             any key to continue       ^Y"
  145.    waitfor keyboard
  146.    if keyboard ^[ goto exit
  147.    goto window
  148.    # exit
  149.    display "^L"
  150.    stop
  151.  
  152. 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.
  153.  
  154. Following is the same macro but without the fancy screen formatting.
  155. This macro is included on the front side of the disk as "sample.macro".
  156.  
  157. # start
  158. # -  Logon Macro for pro-colony
  159.  
  160. # - set up modem
  161. set timer 5
  162. xmit "ATS7=50^M"
  163. set duplex full
  164. set baud 1200
  165. waitfor string "ok"
  166. pause 5
  167.  
  168. # window
  169. display "^LCalling: pro-colony ^J^J^M"
  170. display "To dial Pulse type `P`, or ^J^M"
  171. display "Any other key to dial Touch-Tone^J^M"
  172. display "Enter --> "
  173.  
  174. # - dial tone or pulse?
  175. waitfor keyboard
  176. if keyboard p goto pulse
  177. if keyboard ^[ goto abort
  178. goto tone
  179.  
  180. # - display pulse screen
  181. # Pulse
  182. display "^MNow Dialing with Pulse^J^M"
  183. xmit "ATDP 1 214 370 7056 ^M"
  184. set timer 60
  185. goto begin
  186.  
  187. # Tone
  188. display "^MNow Dialing with Touch-Tone^J^M"
  189. xmit "ATDT 1 214 370 7056 ^M"
  190. set timer 60
  191. goto begin
  192.  
  193. # begin
  194. waitfor string "connect"
  195. if failed goto restart
  196. buffer on
  197.  
  198. # - prompt for user name
  199. waitfor string "login:"
  200. xmit "datalink^M"
  201. stop
  202.  
  203. # restart
  204. hangup
  205. display "^MNo answer or busy. Press a key to continue"
  206. waitfor keyboard
  207. goto window
  208.  
  209. # abort
  210. display "^MPress <esc> to quit or any other key to continue"
  211. waitfor keyboard
  212. if keyboard ^[ goto exit
  213. goto window
  214. # exit
  215. display "^L"
  216. stop
  217.  
  218. 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.
  219.  
  220.  
  221.