home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PROGRAMS / UTILS / COMMUNIC / CA24_1.ZIP / SCRIPTS.ZIP / DIALER.CMD < prev    next >
Encoding:
Text File  |  1988-10-11  |  18.5 KB  |  811 lines

  1. ; ----- COM-AND Multi-dialer script
  2. ;
  3. ;    This script opens a window and asks for up to 10 dialing directory
  4. ;    numbers (with or without long distance prefix).  As numbers are
  5. ;    selected, the dialing directory values are displayed (and the dialing
  6. ;    directory may be cycled through, searching).
  7. ;
  8. ;    When dialing is initiated, the current selections are saved to a file
  9. ;    on the current drive/subdirectory named DIALER.DAT.  If a connection
  10. ;    is made, the DIALER.DAT is updated to eliminate the connection just
  11. ;    made from the list.
  12. ;
  13. ;    If a script is associated with the dialing directory entry to which
  14. ;    connection is made, it is EXECUTED just as if from Alt-D.
  15. ;
  16. ;    R.McG, commenced 10/88
  17. ; ----- Usages -----------------
  18. ;    S19 -----> Parameter string read/written to the .DAT file
  19. ;    N8 ------> Saved cursor row #
  20. ;    N9 ------> Saved cursor col #
  21. ;    N10-N19 -> Working storage for the screen display (LD# and DD#)
  22. ; ------------------------------
  23. ;    Initialization
  24. ;
  25. ;* TRACE ON
  26.    CLEAR
  27.    CURSOR N8,N9             ; Save cursor on entry
  28.    ON ESCAPE GOSUB Exit         ; SAVE is performed in Window
  29.    LEGEND " Multi-dialer pop-up"
  30.    SET TTHRU OFF            ; Disallow typeahead
  31. ;
  32. ;    Paint an initial window, using saved values
  33. ;
  34.    GOSUB Window             ; Open the window
  35.    GOSUB Get_Last            ; Get last Parm string
  36.    GOSUB Parse_Parm            ; Parse_Parms
  37.    GOSUB All_Fields            ; Display all fields
  38.  
  39.    LOCATE 7,8                ; Set cursor to 1st entry
  40. ;
  41. ;    Main-loop - look for keyentry
  42. ;
  43. Main_Loop:
  44.    SET TTHRU OFF            ; Disallow typeahead
  45.    KEYGET S0                ; Get a keystroke
  46. ;
  47. ;    Act upon the keystroke
  48. ;
  49. Have_Key:
  50.    SWITCH S0
  51.       CASE "4900"                       ; Pgup
  52.      GOTO PgUp
  53.       ENDCASE
  54.       CASE "5100"                       ; PgDn
  55.      GOTO PgDn
  56.       ENDCASE
  57.       CASE "4700"                       ; Home
  58.      GOTO Home
  59.       ENDCASE
  60.       CASE "4F00"                       ; End
  61.      GOTO End
  62.       ENDCASE
  63.       CASE "0D"                         ; C/r
  64.      GOTO Perform
  65.       ENDCASE
  66.       CASE "4800"                       ; Cursor up
  67.      GOTO UpLine
  68.       ENDCASE
  69.       CASE "5000"                       ; Cursor down
  70.      GOTO DnLine
  71.       ENDCASE
  72.       CASE "4B00"                       ; Cursor Left
  73.      GOTO Left
  74.       ENDCASE
  75.       CASE "4D00"                       ; Cursor right
  76.      GOTO Right
  77.       ENDCASE
  78.       CASE "09"                         ; Tab
  79.      GOTO Right
  80.       ENDCASE
  81.       CASE "0F00"                       ; Shift-tab
  82.      GOTO Left
  83.       ENDCASE
  84.    ENDSWITCH
  85. ;
  86. ;     Any other keystrokes must be ASCII keys
  87. ;
  88.    IF NOT NULL S0(1:3)
  89.       SOUND 100,100
  90.       GOTO Main_Loop
  91.       ENDIF
  92. ;
  93. ;     Decide where we are by the current cursor, and begin field entry
  94. ;
  95.    CURSOR N0,N1
  96.    IF GE N1 11
  97.       GOSUB Enter_DD            ; Enter dialing directory #
  98.       GOTO Have_Key            ; Return with a new keystroke
  99.    ELSE
  100.       GOSUB Enter_LD            ; Enter Long distance #
  101.       GOTO Right            ; Move to next field
  102.       ENDIF
  103. ;
  104. ; ----- Page up (cycle backwards through possible values)
  105. ;
  106. PgUp:
  107.    CURSOR N1,N2
  108.    IF GE N2 11
  109.       N0 = N10[N1-7]
  110.       N3 = N0/1000            ; Cycle DD#
  111.       N0 = N0-(N0/1000)*1000
  112.       N0 = N0-1
  113.       IF LT N0 0
  114.      N0 = 100
  115.      ENDIF
  116.       N0 = N0+N3*1000
  117.    ELSE
  118.       N0 = N10[N1-7]
  119.       N3 = N0-(N0/1000)*1000        ; Cycle LD#
  120.       N0 = N0/1000
  121.       N0 = N0-1
  122.       IF LT N0 0
  123.      N0 = 4
  124.      ENDIF
  125.       N0 = N3+N0*1000
  126.       ENDIF
  127. ;
  128. ;    Restore the value (N0, index N1) and display
  129. ;
  130.    N10[N1-7] = N0
  131.    GOSUB One_Field
  132.    GOTO Main_Loop
  133. ;
  134. ; ----- Page down (cycle forwards through possible values)
  135. ;
  136. PgDn:
  137.    CURSOR N1,N2
  138.    IF GE N2 11
  139.       N0 = N10[N1-7]
  140.       N3 = N0/1000            ; Cycle DD#
  141.       N0 = N0-(N0/1000)*1000
  142.       N0 = N0+1
  143.       IF GT N0 100
  144.      N0 = 0
  145.      ENDIF
  146.       N0 = N0+N3*1000
  147.       N10[N1-7] = N0
  148.       GOSUB One_Field
  149.    ELSE
  150.       N0 = N10[N1-7]
  151.       N3 = N0-(N0/1000)*1000        ; Cycle LD#
  152.       N0 = N0/1000
  153.       N0 = N0+1
  154.       IF GT N0 4
  155.      N0 = 0
  156.      ENDIF
  157.       N0 = N3+N0*1000
  158.       ENDIF
  159. ;
  160. ;    Restore the value (N0, index N1) and display
  161. ;
  162.    N10[N1-7] = N0
  163.    GOSUB One_Field
  164.    GOTO Main_Loop
  165. ;
  166. ; ----- Up a line
  167. ;
  168. UpLine:
  169.    CURSOR N0,N1
  170.    N0 = N0-1
  171.    IF LT N0 7
  172.       N0 = 16
  173.       ENDIF
  174.    IF GE N1 11
  175.       N1 = 11                ; Set new start-of-field
  176.    ELSE
  177.       N1 = 8                ; Set new start-of-field
  178.       ENDIF
  179.    LOCATE N0,N1
  180.    GOTO Main_Loop
  181. ;
  182. ; ----- Down a line
  183. ;
  184. DnLine:
  185.    CURSOR N0,N1
  186.    N0 = N0+1
  187.    IF GT N0 16
  188.       N0 = 7
  189.       ENDIF
  190.    IF GE N1 11
  191.       N1 = 11                ; Set new start-of-field
  192.    ELSE
  193.       N1 = 8                ; Set new start-of-field
  194.       ENDIF
  195.    LOCATE N0,N1
  196.    GOTO Main_Loop
  197. ;
  198. ; ----- Home (move to first line)
  199. ;
  200. Home:
  201.    LOCATE 7,8
  202.    GOTO Main_Loop
  203. ;
  204. ; ----- End (Move to last line)
  205. ;
  206. End:
  207.    LOCATE 11,8
  208.    GOTO Main_Loop
  209. ;
  210. ; ----- Left (Next field)
  211. ;
  212. Left:
  213.    CURSOR N0,N1
  214.    IF GE N1 11
  215.       N1 = 8                ; Move to previous field
  216.    ELSE
  217.       N0 = N0-1             ; Move to previous line
  218.       N1 = 11
  219.       ENDIF
  220.    IF LT N0 7                ; Last field
  221.       N0 = 16                ; Wrap
  222.       ENDIF
  223.    LOCATE N0,N1             ; And reposition cursor
  224.    GOTO Main_Loop
  225. ;
  226. ; ----- Right (Previous field)
  227. ;
  228. Right:
  229.    CURSOR N0,N1
  230.    IF GE N1 11
  231.       N0 = N0+1             ; Move to next row
  232.       N1 = 8
  233.    ELSE
  234.       N1 = 11                ; Move to next field
  235.       ENDIF
  236.    IF GT N0 16                ; Last field
  237.       N0 = 7                ; Wrap
  238.       ENDIF
  239.    LOCATE N0,N1             ; And reposition cursor
  240.    GOTO Main_Loop
  241. ;
  242. ; ----- Subroutine Exit - terminate the process
  243. ;
  244. Exit:
  245.    RESTORE                ; Saved screen
  246.    LOCATE N8,N9             ; Restore cursor
  247.    EXIT
  248. ;
  249. ; ----- Subroutine: Enter a dialing directory #
  250. ;    .. on entry S0 -> The first keystroke
  251. ;    .. N1 within this subroutine is always current row#
  252. ;    .. S9 within this subroutine the field being constructed
  253. ;    .. N6 within this subroutine is an index to field being constructed
  254. ;
  255. Enter_DD:
  256.    CURSOR N1,N2             ; Get current row
  257.    N0 = N10[N1-7]
  258.    N0 = (N0/1000)*1000            ; Fake a 0 DD# with old LD#
  259.    GOSUB One_Field            ; Clear previous values on screen
  260.    N6 = 0                ; Index to field being built
  261.    S9 = ""                              ; Clear field
  262. ;
  263. ;    Look for an initial space or backspace (this 'blank's the field)
  264. ;
  265.    IF STRCMP S0 " "                     ; If enter with space
  266.       N10[N1-7] = N0
  267.       GOTO DD_Keypress            ; Start w/new key
  268.       ENDIF
  269.    IF STRCMP S0 "08"                    ; If enter with backspace
  270.       N10[N1-7] = N0
  271.       GOTO DD_Keypress            ; Start w/new key
  272.       ENDIF
  273. ;
  274. ;    The space bar terminates data entry
  275. ;
  276. DD_Test:
  277.    IF STRCMP S0 " "                     ; If space key
  278.       S0 = "4D00"                       ; Fake a cursor right
  279.       GOTO DD_Store            ; End of routine
  280.       ENDIF
  281. ;
  282. ;    Look for special chars (tab, and backspace, and non-ASCII)
  283. ;
  284.    SWITCH S0
  285.       CASE "09"                         ; Tab key
  286.      GOTO DD_Store
  287.       ENDCASE
  288.       CASE "0D"                         ; Carriage rtn end field here
  289.      S0 = "4D00"                    ; Fake a cursor right
  290.      GOTO DD_Store
  291.       ENDCASE
  292.       CASE "08"                         ; Backspace
  293.      IF GT N6 0            ; If anything entered
  294.         CURSOR N1,N2
  295.         N2 = N2-1
  296.         LOCATE N1,N2
  297.         ATSAY  N1,N2 (default) " "
  298.         S1(N6:N6) = " "
  299.         N6 = N6-1
  300.         ENDIF
  301.      GOTO DD_Keypress        ; And go for another key
  302.       ENDCASE
  303.    ENDSWITCH
  304.    IF NOT NULL S0(1:3)            ; Not ascii key
  305.       GOTO DD_Store            ; End of routine
  306.       ENDIF
  307. ;
  308. ;    Filter only numeric chars here
  309. ;
  310.    CTOI S0 N0                ; Easier comparison
  311.    IF LT N0 48                ; 48 = '0'
  312.       GOTO DD_Invalid
  313.       ENDIF
  314.    IF GT N0 57                ; 56 = '9'
  315.       GOTO DD_Invalid
  316.       ENDIF
  317. ;
  318. ;    Add the character to our field being constructed
  319. ;
  320.    S9(N6:N6) = S0            ; Add the char
  321.    N6 = N6+1
  322. ;
  323. ;    Display the keystroke in S0
  324. ;
  325.    CURSOR N1,N2
  326.    ATSAY N1,N2 (default) S0(0:0)
  327.    N2 = N2+1                ; Increment cursor
  328.    LOCATE N1,N2
  329. ;
  330. ;    Loop for more (unless field is full)
  331. ;
  332.    IF GE N6 3                ; 3 digits entered
  333.       S0 = "4D00"                       ; Fake a cursor right
  334.       GOTO DD_Store            ; Can't be more
  335.       ENDIF
  336.    GOTO DD_Keypress
  337. ;
  338. ;    Invalid keypress
  339. ;
  340. DD_Invalid:
  341.    SOUND 100,100
  342. ;
  343. ;    Request the next key
  344. ;
  345. DD_Keypress:
  346.    KEYGET S0
  347.    GOTO DD_Test
  348. ;
  349. ;    Update the remainder of the display too
  350. ;
  351. DD_Store:
  352.    IF EQ N6 0                ; Nothing stored
  353.       GOTO DD_Exit            ; Cancel entry
  354.       ENDIF
  355.    N3 = S9                ; Save current value
  356.    IF GT N3 100             ; Set upper bound
  357.       N3 = 100
  358.       ENDIF
  359.    IF LT N3 1                ; Set lower bound
  360.       N3 = 1
  361.       ENDIF
  362.    N0 = N10[N1-7]
  363.    N0 = N3+(N0/1000)*1000        ; Add new DD# and old LD#
  364.    N10[N1-7] = N0
  365. ;
  366. ;    Update the display and we're done
  367. ;
  368. DD_Exit:
  369.    N0 = N10[N1-7]
  370.    GOSUB One_Field            ; Using N0,N1
  371.    RETURN
  372. ;
  373. ; ----- Subroutine: Enter a long distance #
  374. ;    .. on entry S0 -> The first keystroke
  375. ;
  376. Enter_LD:
  377.    SWITCH S0
  378.      CASE "+"
  379.     N0 = 1
  380.      ENDCASE
  381.      CASE "-"
  382.     N0 = 2
  383.      ENDCASE
  384.      CASE "#"
  385.     N0 = 3
  386.      ENDCASE
  387.      CASE "@"
  388.     N0 = 4
  389.      ENDCASE
  390.      CASE "1"
  391.     N0 = 1
  392.      ENDCASE
  393.      CASE "2"
  394.     N0 = 2
  395.      ENDCASE
  396.      CASE "3"
  397.     N0 = 3
  398.      ENDCASE
  399.      CASE "4"
  400.     N0 = 4
  401.      ENDCASE
  402.      DEFAULT
  403.     N0 = 0
  404.     S0 = " "
  405.     SOUND 100,100
  406.      ENDCASE
  407.    ENDSWITCH
  408. ;
  409. ;    Clear the field, and redisplay
  410. ;
  411.    CURSOR N1,N2
  412.    ATSAY  N1,N2 (Default) S0(0:0)
  413. ;
  414. ;    Update the remainder of the display too
  415. ;
  416.    N3 = N0                ; Save current value
  417.    N0 = N10[N1-7]
  418.    N0 = N0-(N0/1000)*1000        ; Extract DD#
  419.    N0 = N0+N3*1000            ; Add new DD#
  420.    N10[N1-7] = N0
  421. ;
  422. ;    Flesh out the display and we're done
  423. ;
  424.    GOSUB One_Field            ; Using N0,N1
  425.    RETURN
  426. ;
  427. ; ----- Display a single field
  428. ;    .. N0 -> The LD code*1000 + the dialing directory #
  429. ;       N1 -> The display line #
  430. ;    .. N2,N3,S10,S11 are modified
  431. ;
  432. One_Field:
  433.    S10 = "                                                                      "
  434.    ATSAY N1,7  (Default) S10(0:67)
  435. ;
  436. ;    Extract the LD code and dialing directory #
  437. ;
  438.    N2 = N0/1000             ; Set LD #
  439.    N3 = N0-(N0/1000)*1000        ; Set dialing directory #
  440. ;
  441. ;    Set-up the LD code for display
  442. ;
  443.    IF NOT ZERO N2
  444.       S10(0:2) = " "*N2
  445.       LD S11 N2
  446.       S10(8:30) = S11
  447.       ENDIF
  448. ;
  449. ;    Set-up the dialing directory # for display
  450. ;
  451.    IF NOT ZERO N3
  452.       S10(4:6) = N3
  453.       DNUM S11 N3
  454.       S10(32:45) = S11
  455.       DIRECTORY S11 N3
  456.       S10(47:79) = S11
  457.       ENDIF
  458. ;
  459. ;    And display the entry
  460. ;
  461.    ATSAY N1,7  (Default) S10(0:67)
  462.    RETURN
  463. ;
  464. ; ----- Subroutine: Display all fields
  465. ;    .. N0,N1,N2,N3,S10,S11 are destroyed
  466. ;
  467. All_Fields:
  468.    N0 = N10
  469.    N1 = 7
  470.    GOSUB One_Field            ; Display a single field
  471.  
  472.    N0 = N11
  473.    N1 = 8
  474.    GOSUB One_Field            ; Display a single field
  475.  
  476.    N0 = N12
  477.    N1 = 9
  478.    GOSUB One_Field            ; Display a single field
  479.  
  480.    N0 = N13
  481.    N1 = 10
  482.    GOSUB One_Field            ; Display a single field
  483.  
  484.    N0 = N14
  485.    N1 = 11
  486.    GOSUB One_Field            ; Display a single field
  487.  
  488.    N0 = N15
  489.    N1 = 12
  490.    GOSUB One_Field            ; Display a single field
  491.  
  492.    N0 = N16
  493.    N1 = 13
  494.    GOSUB One_Field            ; Display a single field
  495.  
  496.    N0 = N17
  497.    N1 = 14
  498.    GOSUB One_Field            ; Display a single field
  499.  
  500.    N0 = N18
  501.    N1 = 15
  502.    GOSUB One_Field            ; Display a single field
  503.  
  504.    N0 = N19
  505.    N1 = 16
  506.    GOSUB One_Field            ; Display a single field
  507.    RETURN                ; And we're done
  508. ;
  509. ; ----- Subroutine: Parse a parameter string in S19 into numeric variables
  510. ;    .. N10-N19 are returned either set to 0, or a dialing directory #
  511. ;       S19 -> The saved dialing command
  512. ;    .. N0,N1 are modifed
  513. ;
  514. Parse_Parm:
  515.    FOR N0 = 0,36,4            ; 10x
  516.      N1 = N0+3
  517.      ATOI S19(N0:N1) N1
  518.      IF ERROR                ; Delimiter
  519.     N1 = 0
  520.     ENDIF
  521.      N10 = N11
  522.      N11 = N12
  523.      N12 = N13
  524.      N13 = N14
  525.      N14 = N15
  526.      N15 = N16
  527.      N16 = N17
  528.      N17 = N18
  529.      N18 = N19
  530.      N19 = N1
  531.      ENDFOR
  532.    RETURN
  533. ;
  534. ; ----- Subroutine: Get the last dialing parameter used
  535. ;    .. S19 returns the parameter
  536. ;
  537. Get_Last:
  538.    S19 = "DIALER.DAT"
  539.    IF ISFILE S19
  540.       FOPENI "DIALER.Dat" TEXT           ; Name of data file
  541.       IF FAILURE
  542.      GOTO No_Get
  543.      ENDIF
  544.    ELSE
  545.       GOTO No_Get
  546.       ENDIF
  547. ;
  548. ;    Read the firt record in the file
  549. ;
  550.    READ S19 80 N0
  551.    IF EOF
  552.       GOTO No_Get
  553.       ENDIF
  554.    FCLOSEI                ; Done for now
  555.    RETURN
  556. ;
  557. ;    No file or record
  558. ;
  559. No_Get:
  560.    S19 = "   "
  561.    RETURN
  562. ;
  563. ; ----- Subroutine: Store current selections for next use
  564. ;    .. S19 is modified
  565. ;
  566. Set_Last:
  567.    S19 = "DIALER.DAT"
  568.    FOPENO "DIALER.Dat" TEXT           ; Name of data file
  569.    IF FAILURE
  570.       RETURN
  571.       ENDIF
  572.    S19(0:4)   = N10
  573.    S19(5:9)   = N11
  574.    S19(10:14) = N12
  575.    S19(15:19) = N13
  576.    S19(20:24) = N14
  577.    S19(25:29) = N15
  578.    S19(30:34) = N16
  579.    S19(35:39) = N17
  580.    S19(40:44) = N18
  581.    S19(45:49) = N19
  582.    WRITE S19 50
  583.    FCLOSEO
  584.    RETURN
  585. ;
  586. ; ----- Open a window with blank fields
  587. ;
  588. Window:
  589.    SAVE   1,5  23 75
  590.    BOX      1,5  23 75 (default)
  591.    ATSAY  1,7  (default)   " COM-AND Multi-dialer "
  592.  
  593.    ATSAY  2,7  (default)   "Select up to 10 dialing directory entries (using or not using a long"
  594.    ATSAY  3,7  (default)   "distance prefix).  Sequential redial begins when you hit return."
  595.    ATSAY  4,5  (default) "├─────────────────────────────────────────────────────────────────────┤"
  596.    ATSAY  5,7  (default)   "LD# DD#   (from LD directory)        (from dialing directory)"
  597.    ATSAY  6,7  (default)   "--- --- ----------------------- -------------- --------------------"
  598.  
  599.    ATSAY 17,5  (default) "├─────────────────────────────────────────────────────────────────────┤"
  600.    ATSAY 18,7  (default)   "Use cursor up/down to select a line in the display.  Use cursor left"
  601.    ATSAY 19,7  (default)   "and right to select a field.  PgUp/PgDn cycle possible values."
  602.    ATSAY 20,7  (default)   "LD codes are 0,' ' = none, 1 or +, 2 or -, 3 or #, 4 or @.  DD codes"
  603.    ATSAY 21,7  (default)   "are 1-100.  Current values are always displayed.  Empty entries are"
  604.    ATSAY 22,7  (default)   "ignored.  A carriage return begins the dialing sequence."
  605.    ATSAY 23,30 (default)            " Press ESC to exit "
  606.    RETURN
  607. ;
  608. ; ----- Subroutine: Set for dialing
  609. ;    .. N2 on entry is the directory #
  610. ;
  611. Set_Dialing:
  612.    DPARM S0 N2                ; Get dialing parms
  613.    ATSAY 21,7  (default) S0
  614.  
  615.    S1 = S0(5:5)
  616.    SWITCH S1                ; Parity
  617.       CASE "E"
  618.     SET PARITY EVEN
  619.       ENDCASE
  620.       CASE "O"
  621.     SET PARITY ODD
  622.       ENDCASE
  623.       CASE "N"
  624.     SET PARITY NONE
  625.       ENDCASE
  626.    ENDSWITCH
  627.  
  628.    S1 = S0(7:7)
  629.    SWITCH S1                ; Data bits
  630.       CASE "7"
  631.     SET DATA 7
  632.       ENDCASE
  633.       CASE "8"
  634.     SET DATA 8
  635.       ENDCASE
  636.    ENDSWITCH
  637.  
  638.    S1 = S0(9:9)
  639.    SWITCH S1                ; Stop bits
  640.       CASE "1"
  641.     SET STOP 1
  642.       ENDCASE
  643.       CASE "2"
  644.     SET DATA 2
  645.       ENDCASE
  646.    ENDSWITCH
  647.  
  648.    S1 = S0(0:3)
  649.    SWITCH S1                ; Baud rate
  650.       CASE " 300"
  651.     SET BAUD 300
  652.       ENDCASE
  653.       CASE "1200"
  654.     SET BAUD 1200
  655.       ENDCASE
  656.       CASE "2400"
  657.     SET BAUD 2400
  658.       ENDCASE
  659.       CASE "4800"
  660.     SET BAUD 4800
  661.       ENDCASE
  662.       CASE "9600"
  663.     SET BAUD 9600
  664.       ENDCASE
  665.    ENDSWITCH
  666.  
  667.    IF STRCMP S0(11:11) "Y"              ; Echo Y/N
  668.       SET DUPLEX HALF
  669.    ELSE
  670.       SET DUPLEX FULL
  671.    ENDIF
  672.    RETURN
  673. ;
  674. ;    This exit is taken after we begin to perform the dialing sequence
  675. ;
  676. Exit_Perform:
  677.    HANGUP                ; HANGUP - may be dialing
  678.    RESTORE                ; Clear 2nd window
  679.    GOTO Exit
  680. ;
  681. ; ----- We got a connection
  682. ;    .. N1 -> The selected entry
  683. ;
  684. Got_It:
  685.    RESTORE                ; Clear 2nd window
  686.    RESTORE                ; Clear 1st window
  687.    LOCATE N8,N9             ; Restore cursor
  688.    SET RDISP ON             ; Turn on display
  689. ;
  690. ;    Clear the entry selected here from the saved list
  691. ;
  692.    N0 = 0                ; Set cleared value
  693.    N10[N1-7] = N0
  694.    GOSUB Set_Last            ; Save updated list for next time
  695. ;
  696. ;    If this entry has a script, execute it
  697. ;
  698.    DSCRIPT S0,N2            ; Look for a script
  699.    IF NOT NULL S0
  700.       SET LINKED ON            ; Fake from Alt-D
  701.       EXECUTE S0            ; Chain to new script
  702.       ENDIF
  703.    CONNECT                ; Go to terminal mode
  704. ;
  705. ; ----- We are to perform the redial - is there anything?
  706. ;
  707. Perform:
  708.    N6 = 0
  709.    FOR N1 = 7,16
  710.        N0 = N10[N1-7]
  711.        N2 =  N0-N0/1000*1000        ; DD#
  712.        IF NOT ZERO N2            ; If there's an entry here
  713.       GOTO Set_Up            ; Start
  714.       ENDIF
  715.        ENDFOR
  716. ;
  717. ;    Nothing to do
  718. ;
  719.    SOUND 100,100
  720.    GOTO Main_Loop            ; And continue
  721. ;
  722. ;    Set-up a new environment
  723. ;
  724. Set_Up:
  725. ;* TRACE ON
  726.    SET TTHRU ON             ; Allow typethrough
  727.    KFLUSH
  728.    SET RDISP OFF            ; Turn off display
  729.    ON ESCAPE GOSUB Exit_Perform     ; New exit
  730.    LEGEND " Cycling through selected #'s"
  731. ;
  732. ;    Save the current selection for the next invocation
  733. ;
  734.    GOSUB Set_Last            ; Save whole list in case of Escape
  735. ;
  736. ;    Open a window over the last one.
  737. ;
  738.    SAVE   17,5 23 75
  739.    BOX      17,5 23 75 (default)
  740.    ATSAY  17,7    (default) " COM-AND Dialing "
  741.    ATSAY  23,22 (default) " CR to move to next, ESC to terminate "
  742. ;
  743. ;    Set control values
  744. ;
  745.    N6 = 0                ; Display counter
  746.    N5 = 35                ; TImeout in seconds
  747. ;
  748. ;    Loop until escape or connect
  749. ;    .. Note: N1 and N2 must be preserved within the loop
  750. ;
  751. Loop:
  752.    FOR N1 = 7,16            ; Loop index (preserve this value!)
  753.        ;
  754.        ;  Get the current entry's value (0 = not used)
  755.        ;
  756.        N0 = N10[N1-7]
  757.        N2 =  N0-N0/1000*1000        ; DD# (preserve this value!)
  758.        N3 =  N0/1000*1000        ; LD#
  759.  
  760.        IF NOT ZERO N2
  761.       N6 = N6+1
  762.       ATSAY 18,7  (default) "Retry #: "*N6*";  Started: "*"_time"*";  Timeout = "*N5*" seconds"
  763.       ATSAY 19,7  (default) "                              " ; clear
  764.       ATSAY 20,7  (default) "                              " ; clear
  765.       ATSAY 21,7  (default) "                              " ; clear
  766.       ATSAY 22,7  (default) "                              " ; clear
  767.       ;
  768.       ;  Using values for this entry get name, number and LD prefix
  769.       ;
  770.       DIRECTORY S1 N2
  771.       DNUM S2 N2
  772.       LD S3 N3
  773.       ATSAY 19,7  (default) S1
  774.       ATSAY 20,7  (default) S2&S3
  775.       ;
  776.       ;  Set parity, data and stop bits, echo, and speed
  777.       ;
  778.       GOSUB Set_Dialing
  779.       ;
  780.       ;  Hangup and send the dialing sequence
  781.       ;
  782.       RFLUSH
  783.       S0 = "_DPREFIX" & S2 & S3 & "_DSUFFIX"
  784.       TRANS "_MESCAPE"
  785.       TRANS "_MHANGUP"
  786.       WAITFOR "OK" 5                ; Clear line of modem's "OK"
  787.       TRANS S0
  788.       ATSAY 22,7  (default) "Dialing"
  789.       ;
  790.       ;  Wait for a non-null response from the modem
  791.       ;
  792.       N0 = N5
  793.       SET TIMER
  794.       WHILE GT N0 0
  795.          RGET S0 80 N0        ; Wait up to a limit secs
  796.          IF NOT NULL S0
  797.         IF FIND S0 "_MCONNECT"&""  ; Trim trailing blanks
  798.            GOTO Got_It
  799.         ELSE
  800.            ATSAY 22,7  (default) S0
  801.            PAUSE 5
  802.            N0 = -N5        ; Force end of loop
  803.            ENDIF
  804.         ENDIF
  805.          TSINCE N3,N3,N4        ; Throw away Hrs
  806.          N0 = N0-N4         ; Compute total time
  807.          ENDWHILE
  808.       ENDIF
  809.        ENDFOR
  810.    GOTO Loop                ; Loops forever - 'til ESC or connect
  811.