/* APAGE.CMD */
/* ZOC Script to access alpha pagers */
/* copyright (c) 1995 by Mark E. Moran, D.O. */
/* version - 0.01 Last update: Jun 20, 1995 */
/* I'm not quite sure you get an error code of '0' from ZOC once the
script is complete w/ ZOC v2.08, but all appears to work fine.
Markus a bug?
Here's what I'm talking about:
*** SCRIPT-ERROR: Unknown command: 0
*** from REXX: WAIT Thank you. */
/* Future updates?: more verbose error log
your suggestions to:
CIS 71615.757 or,
mmoran@saturn.csee.lehigh.edu */
/* This file may be used w/o fee but may not be resold &
the copyright notices may not be removed
This program may be freely mdistributed w/ ZOC by Markus Schmidt */
/* Debugging stuff
TRACE ALL
logging 1 */
/* Start of the real thing */
CLS
say 'Alpha Pager v0.01'
say 'copyright (c) 1995 by Mark E. Moran, D.O. USA'
lf = '^M'
/* User defined variables */
modeminit = 'AT&N1' /* Init string for modem */
phoneno = '555-1212' /* Phone number to access pager system
*/
pagerno = '1111' /* Invidual pager number */
logfile = 'G:\MARK\PAGER.LOG' /* Log file for pages */
/* logfile = '' if you don't want a
log */
maxlen = 110 /* Max of length of msg */
txtfile = 'G:\MARK\PAGER.TXT' /* Msg text */
/* Text file containing msg. If this file is found it is used for the
msg to send to the pager. Otherwise the user is asked for the text */
msg = ''
rc = STREAM(txtfile,'C','open read') /* Try to open text msg file */
IF rc <> 'READY:' THEN
DO
'ASK "Enter your message:"' /* Get msg to be sent and save it
*/
msg = zocresult()
/* The max chars ZOC seems to allow me to enter is 80. So if
you're
close to that and your 'maxlen' allows it. You can continue your
msg */
IF LENGTH(msg) > 75 AND maxlen > 75 THEN
DO
'ASK "Continue your message:"'
msg = msg || zocresult()
END
ELSE
nop
END
ELSE
DO UNTIL LINES(txtfile) = 0
msg = msg || LINEIN(txtfile)
END
'BAUD [1]300-7E1' /* Seems most systems have HIGH powered 300 baud
modems */
TIMEOUT 60 /* Hay we're working at 300 baud, be patient */
SEND modeminit || lf /* Init the modem */
WAIT 'OK'
SAY zoclastline()
IF zoclastline() <> 'OK' THEN
SIGNAL ErrorReport
ELSE
nop
/* Dial system */
DIAL phoneno
WAIT 'CONNECT'
IF zoclastline() <> 'CONNECT' THEN
SIGNAL ErrorReport
ELSE
nop
SEND lf /* Sync up with the system */
WAIT 'ID='
IF zoclastline() <> 'ID=' THEN
SIGNAL ErrorReport
ELSE
nop
SEND 'M' || lf
WAIT 'Pager number?'
IF zoclastline() <> 'Pager number?' THEN
SIGNAL ErrorReport
ELSE
nop
SEND pagerno || lf
WAIT 'Message?'
IF zoclastline() <> 'Message?' THEN
SIGNAL ErrorReport
ELSE
nop
SEND msg || lf
WAIT 'Thank you.'
IF zoclastline() <> 'Thank you.' THEN
SIGNAL ErrorReport
ELSE
nop
SAY 'Page sent successfully.'
/* Log your success */
IF logfile <> '' THEN /* Make sure we want a log */
DO
rc = STREAM(logfile,'C','open write') /* Open log file */
rc = STREAM(logfile,'C','seek <0') /* Jump to the end */
LINEOUT(logfile,DATE('U') || ' ' || TIME('N') || ' ' || msg)
rc = STREAM(logfile,'C','close')
END
ELSE
nop
ENDZOC
EXIT /* The End */
ErrorReport:
/* Log your failure */
IF logfile <> '' THEN /* Make sure we want a log */
DO
rc = STREAM(logfile,'C','open write') /* Open log file */
rc = STREAM(logfile,'C','seek <0') /* Jump to the end */
rc = LINEOUT(logfile,DATE('U') || ' ' || TIME('N') || ' E:' msg)
rc = STREAM(logfile,'C','close')
END
ELSE
nop
say 'Error code returned'
EXIT