Page-Me

 BBS: Inland Empire Archive
Date: 01-21-93 (06:42)             Number: 394
From: JAMES VAHN                   Refer#: NONE
  To: ALL                           Recvd: NO  
Subj: Page-Me                        Conf: (2) Quik_Bas
A recent question got me to thinking and I came up with this- it
watches the phone line for a RING from the modem and calls
another number (my pager) to let me know a message might be on
the answering machine, which I can call to get the messages that
I usually miss.. Now if I could just get it to talk..  ;-)

'===============================================================
' page-me.bas  James Vahn 1:30854/20@fidonet
' Wait for the phone to ring, then dials a pager number.
'
ON COM(2) GOSUB GetBuf
COM(2) ON

OPEN "COM2:2400,N,8,1" FOR RANDOM AS #1
OPEN "CONS:" FOR OUTPUT AS #2
OPEN "pager.log" FOR APPEND AS #3

Dial$ = "ATDT 555-1212,,,,,,123" ' Pager phone number-
                                 ' each comma is a modem delay.
CLS
LOCATE , , 1                     ' Turn a cursor on.


PRINT #1, "ATZ"
td! = 2: GOSUB delay
PRINT #1, "AT S0=0 V1 M0"        ' Mostly turn verbal codes on..
td! = 2: GOSUB delay

' We'll loop forever....
DO
  PRINT #2, "Waiting for a call..  Hit ALT-X to exit."
   DO
       GOSUB Keyscan
       test = INSTR(RIGHT$(ModemIn$, 8), "RING")
        IF test THEN EXIT DO          ' Sigh..  It Rang
   LOOP
     td! = 60: GOSUB delay
     PRINT #1, Dial$                  ' Forward the call..
     td! = 30: GOSUB delay
LOOP

' Various subs:
GetBuf:
        InStr$ = INPUT$(LOC(1), #1)   ' Get what's in the modem buffer.
        PRINT #2, InStr$;             ' Print it to the screen via CONS:
        PRINT #3, InStr$;             ' and print it to a disk file log.
        ModemIn$ = RIGHT$(ModemIn$ + InStr$, 10240)' Save it in ModemIn$
RETURN

delay:
    x! = (TIMER + td!) MOD 86400
    WHILE TIMER < x!
    GOSUB Keyscan
    WEND
RETURN

Keyscan:
    a$ = INKEY$
    IF a$ = CHR$(0) + CHR$(45) THEN CLOSE : END '  ALT-X to exit.
RETURN

'-end-

 * SLMR 2.1a *

--- Maximus 2.01wb
 * Origin: Inland Empire Archive (1:346/10)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET