home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 3 Comm
/
03-Comm.zip
/
irishset.zip
/
TAView.cmd
< prev
Wrap
OS/2 REXX Batch file
|
1997-01-12
|
4KB
|
176 lines
/* This is a program to test ComPort addressing and reading! */
ClearPort='ATZ'
ListSetup='AT &v'
ISDNSetup='AT >v=c'
RevNum='ATI8'
phone = '1 303-494-4774'
port = 'COM3'
ESC = 27
keystroke = ''
p1.0 = "\"
p1.1 = "-"
p1.2 = "/"
p1.3 = "-"
p2 = 0
Main:
CALL RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
CALL SysLoadFuncs
ARG CLine
IF CLine \= '' then
CALL CommandLine
else
/* Menu */
DO UNTIL keystroke = '1b'x
CALL SysCls
SAY CENTER(' To set your modem make one of the following selections:', 80)
SAY CENTER('(V)iew current settings', 79)
SAY CENTER('(S)et modem', 68)
SAY CENTER('(I)SDN settings', 72)
SAY CENTER('(R)eset modem', 70)
SAY CENTER('(C)all', 62)
SAY CENTER('(G)et revision number', 78)
SAY CENTER('(H)angup modem', 70)
SAY CENTER('(E)nter COMport', 72)
SAY CENTER('(Q)uit!', 64)
keystroke=SysGetKey('NOECHO')
SELECT
when keystroke = '76'x | keystroke = '56'x then
CALL ModemSettings
when keystroke = '53'x | keystroke = '73'x then
CALL setmodem
when keystroke = '52'x | keystroke = '72'x then
CALL resetmodem
when keystroke = '43'x | keystroke = '63' then
CALL placecall
when keystroke = '48'x | keystroke = '68'x then
CALL hangup
when keystroke = '49'x | keystroke = '69'x then
CALL isdn
when keystroke = '45'x | keystroke = '65'x then
DO
port= "COM" || keystroke || ":"
end
When keystroke = '47'x | keystroke = '67'x then
CALL revisionnum
when keystroke = '51'x | keystroke = '71'x then
CALL done
otherwise
end /* end select */
end /* end do */
done:
SAY 'REALLY quit?(Y/n)'
keystroke = SysGetKey('NOECHO')
IF keystroke = '59'x | keystroke = '79'x then
DO
"CLS"
SAY ''
SAY Copies('#', 79)
SAY CENTER(" G'Day, mate! ", 79, '#')
SAY Copies('#', 79)
exit
END /* end do */
else
return
exit
/* Show modem settings */
ModemSettings:
SAY CENTER(' ', 80, ' ')
CALL LineOut port, ListSetup
Info=''
DO While Chars(port)
Info= Info || CharIn(port)
CALL CharOut , "1B"x || '[s Reading ' || p1.p2 || "1B"x || "[u"
p2 = (p2+1) // 4
end /* end DO */
SAY Info
SAY 'Hit <ENTER> when ready!!'
keystroke = CALL SysGetKey('NOECHO')
return
/* Now to pass the commandline onto the modem */
CommandLine:
Info = ''
CALL LineOut port, CLine
DO While Chars(port)
Info = Info || CharIn(port)
end /* do */
SAY Info
SAY 'Hit <ENTER> when ready!!'
keystroke = CALL SysGetKey('NOECHO')
return
/* Set modem */
setmodem:
SAY 'Hit <ENTER> when ready!!'
keystroke = CALL SysGetKey('NOECHO')
return
/* Reset modem */
resetmodem:
SAY 'Resetting modem'
Info = ''
CALL LineOut port, 'ATZ'
DO While Chars(port)
Info = Info || CharIn(port)
end /* do */
IF POS('OK', Info) <> 0 then
DO
SAY 'Hit <ENTER> when ready!!'
keystroke = CALL SysGetKey('NOECHO')
return 0
END /* end do */
else
SAY CENTER('ERROR: the modem did not respond with expected OK.', 80)
SAY 'Hit <ENTER> when ready!!'
keystroke = CALL SysGetKey('NOECHO')
return 1
/* Place call */
placecall:
SAY 'Placing call'
SAY 'Hit <ENTER> when ready!!'
keystroke = CALL SysGetKey('NOECHO')
return
/* Hangup modem */
hangup:
SAY CENTER("Hanging up modem!", 80)
Info = ''
CALL LineOut port, 'ATH'
DO While Chars(port)
Info = Info || CharIn(port)
end /* do */
IF POS('OK', Info) <> 0 then
DO
SAY 'Hit <ENTER> when ready!!'
keystroke = CALL SysGetKey('NOECHO')
return 0
END /* end do */
else
SAY CENTER('ERROR: the modem did not respond with expected OK.', 80)
SAY 'Hit <ENTER> when ready!!'
keystroke = CALL SysGetKey('NOECHO')
return 1
revisionnum:
SAY CENTER(' ', 80, ' ')
CALL LineOut port, RevNum
Info=''
DO While Chars(port)
Info= Info || CharIn(port)
CALL CharOut , "1B"x || '[s Reading ' || p1.p2 || "1B"x || "[u"
p2 = (p2+1) // 4
end /* end DO */
SAY Info
SAY 'Hit <ENTER> when ready!!'
keystroke = CALL SysGetKey('NOECHO')
return
isdn:
SAY CENTER(' ', 80, ' ')
CALL LineOut port, ISDNSetup
Info=''
DO While Chars(port)
Info= Info || CharIn(port)
CALL CharOut , "1B"x || '[s Reading ' || p1.p2 || "1B"x || "[u"
p2 = (p2+1) // 4
end /* end DO */
SAY Info
SAY 'Hit <ENTER> when ready!!'
keystroke = CALL SysGetKey('NOECHO')
return
exit