home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 3 Comm / 03-Comm.zip / irishset.zip / TAView.cmd < prev   
OS/2 REXX Batch file  |  1997-01-12  |  4KB  |  176 lines

  1. /* This is a program to test ComPort addressing and reading! */
  2. ClearPort='ATZ'
  3. ListSetup='AT &v'
  4. ISDNSetup='AT >v=c'
  5. RevNum='ATI8'
  6. phone = '1 303-494-4774'
  7. port = 'COM3'
  8. ESC = 27
  9. keystroke = ''
  10. p1.0 = "\"
  11. p1.1 = "-"
  12. p1.2 = "/"
  13. p1.3 = "-"
  14. p2 = 0
  15. Main:
  16. CALL RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  17. CALL SysLoadFuncs
  18. ARG CLine
  19. IF CLine \= '' then
  20. CALL CommandLine
  21. else
  22. /* Menu  */
  23. DO UNTIL keystroke = '1b'x
  24. CALL SysCls
  25. SAY CENTER(' To set your modem make one of the following selections:', 80)
  26. SAY CENTER('(V)iew current settings', 79)
  27. SAY CENTER('(S)et modem', 68)
  28. SAY CENTER('(I)SDN settings', 72)
  29. SAY CENTER('(R)eset modem', 70)
  30. SAY CENTER('(C)all', 62)
  31. SAY CENTER('(G)et revision number', 78)
  32. SAY CENTER('(H)angup modem', 70)
  33. SAY CENTER('(E)nter COMport', 72)
  34. SAY CENTER('(Q)uit!', 64)
  35. keystroke=SysGetKey('NOECHO')
  36. SELECT
  37.    when keystroke = '76'x | keystroke = '56'x then
  38.    CALL ModemSettings
  39.    when keystroke = '53'x | keystroke = '73'x then
  40.    CALL setmodem
  41.    when keystroke = '52'x | keystroke = '72'x then
  42.    CALL resetmodem
  43.    when keystroke = '43'x | keystroke = '63' then
  44.    CALL placecall
  45.    when keystroke = '48'x | keystroke = '68'x then
  46.    CALL hangup
  47.    when keystroke = '49'x | keystroke = '69'x then
  48.    CALL isdn
  49.    when keystroke = '45'x | keystroke = '65'x then
  50.    DO
  51.    port= "COM" || keystroke || ":"
  52.    end
  53.    When keystroke = '47'x | keystroke = '67'x then
  54.    CALL revisionnum
  55.    when keystroke = '51'x | keystroke = '71'x then
  56.    CALL done
  57. otherwise
  58. end  /* end select */
  59. end /* end do */
  60. done:
  61. SAY 'REALLY quit?(Y/n)'
  62. keystroke = SysGetKey('NOECHO')
  63. IF keystroke = '59'x | keystroke = '79'x then
  64.   DO
  65.     "CLS"
  66.     SAY ''
  67.     SAY Copies('#', 79)
  68.     SAY CENTER(" G'Day, mate! ", 79, '#')
  69.     SAY Copies('#', 79)
  70.     exit
  71.   END /* end do */
  72. else
  73. return
  74. exit
  75. /* Show modem settings */
  76. ModemSettings:
  77. SAY CENTER(' ', 80, ' ')
  78. CALL LineOut port, ListSetup
  79. Info=''
  80. DO  While Chars(port)
  81.    Info= Info || CharIn(port)
  82.    CALL CharOut , "1B"x || '[s Reading ' || p1.p2 || "1B"x || "[u"
  83.    p2 = (p2+1) // 4
  84.    end  /* end DO */
  85. SAY Info
  86. SAY 'Hit <ENTER> when ready!!'
  87. keystroke = CALL SysGetKey('NOECHO')
  88. return
  89. /* Now to pass the commandline onto the modem */
  90. CommandLine:
  91. Info = ''
  92. CALL LineOut port, CLine
  93. DO While Chars(port)
  94.    Info = Info || CharIn(port)
  95.    end /* do */
  96. SAY Info
  97. SAY 'Hit <ENTER> when ready!!'
  98. keystroke = CALL SysGetKey('NOECHO')
  99. return
  100. /*  Set modem */
  101. setmodem:
  102. SAY 'Hit <ENTER> when ready!!'
  103. keystroke = CALL SysGetKey('NOECHO')
  104. return
  105. /* Reset modem */
  106. resetmodem:
  107. SAY 'Resetting modem'
  108. Info = ''
  109. CALL LineOut port, 'ATZ'
  110. DO While Chars(port)
  111.    Info = Info || CharIn(port)
  112. end /* do */
  113. IF POS('OK', Info) <> 0 then
  114.         DO
  115. SAY 'Hit <ENTER> when ready!!'
  116. keystroke = CALL SysGetKey('NOECHO')
  117.         return 0
  118.         END /* end do */
  119.         else
  120. SAY CENTER('ERROR: the modem did not respond with expected OK.', 80)
  121. SAY 'Hit <ENTER> when ready!!'
  122. keystroke = CALL SysGetKey('NOECHO')
  123. return 1
  124. /* Place call */
  125. placecall:
  126. SAY 'Placing call'
  127. SAY 'Hit <ENTER> when ready!!'
  128. keystroke = CALL SysGetKey('NOECHO')
  129. return
  130. /* Hangup modem */
  131. hangup:
  132. SAY CENTER("Hanging up modem!", 80)
  133. Info = ''
  134. CALL LineOut port, 'ATH'
  135. DO While Chars(port)
  136.    Info = Info || CharIn(port)
  137.    end /* do */
  138. IF POS('OK', Info) <> 0 then
  139.         DO
  140. SAY 'Hit <ENTER> when ready!!'
  141. keystroke = CALL SysGetKey('NOECHO')
  142.         return 0
  143.         END /* end do */
  144.         else
  145. SAY CENTER('ERROR: the modem did not respond with expected OK.', 80)
  146. SAY 'Hit <ENTER> when ready!!'
  147. keystroke = CALL SysGetKey('NOECHO')
  148. return 1
  149. revisionnum:
  150. SAY CENTER(' ', 80, ' ')
  151. CALL LineOut port, RevNum
  152. Info=''
  153. DO  While Chars(port)
  154.    Info= Info || CharIn(port)
  155.    CALL CharOut , "1B"x || '[s Reading ' || p1.p2 || "1B"x || "[u"
  156.    p2 = (p2+1) // 4
  157.    end  /* end DO */
  158. SAY Info
  159. SAY 'Hit <ENTER> when ready!!'
  160. keystroke = CALL SysGetKey('NOECHO')
  161. return
  162. isdn:
  163. SAY CENTER(' ', 80, ' ')
  164. CALL LineOut port, ISDNSetup
  165. Info=''
  166. DO  While Chars(port)
  167.    Info= Info || CharIn(port)
  168.    CALL CharOut , "1B"x || '[s Reading ' || p1.p2 || "1B"x || "[u"
  169.    p2 = (p2+1) // 4
  170.    end  /* end DO */
  171. SAY Info
  172. SAY 'Hit <ENTER> when ready!!'
  173. keystroke = CALL SysGetKey('NOECHO')
  174. return
  175. exit
  176.