/* PageMe.cid
**
** Author: Glenn J. Schworak
**   Date: 11/13/96
**
** This is a simple script that can be used to page you when a
** call comes in. This assumes you have a Numeric pager.
**
** The number of the last call in the History Buffer will be
** sent to your pager so you can call them back.
**
** If you run this script from the Black Book, leave the modem
** setting at "DO NOTHING" mode for proper results.
*/

options results


/* You may need to edit the next 4 lines */

PagerPhoneNumber  = '555-1234'   /* The pager's phone number           */
NoDialTone = 'NO DIALTONE'       /* The modem message if no dial tone  */
TryPause = 60                    /* The delay time between dialing     */
DialPrefix = 'ATDT'              /* The command to dial the modem      */


/*----------- DO NOT EDIT BEYOND THIS POINT ------------*/


Address CID
Serial Open
BuildScratch; Memo = Result      /* Build a scratch pad in memory      */
GetHist 1    Memo                /* Get the last phone call info       */
GetVal 10 Memo; Phone = Result   /* Get the last phone number          */
reply=NoDialTone
try=0
if DataType(Phone,'Numeric') then do         /* Only page if a number  */
	do while reply=NoDialTone & try<5
		shell command 'Wait 'TryPause
		try=try+1
		ModemCMD DialPrefix||PagerPhoneNumber',,,,,'Phone
		reply=phone
		do while pos(phone,reply)>0
			shell command 'wait 10'
			ModemReply; reply=result
		end
	end
end

KillScratch Memo                 /* Give the memory back before ending */
exit
