home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Jason Aller Floppy Collection
/
106.img
/
MIRROR2.ZIP
/
PT&DIAL.XTS
< prev
next >
Wrap
Text File
|
1988-12-15
|
13KB
|
396 lines
;*******************************************************************
;* Point and Dial is a "pop-up" utility used as a quick-dialer *
;* to dial phone numbers. Simply position the cursor at the start *
;* of a phone number and hit Alt-d. Mirror interrupts whatever *
;* application you may be running in the foreground to read in *
;* the number and dial it. Alternately, hitting Alt-m brings up a *
;* menu where you may enter a number and have it dialed, display *
;* a help page or Un-install Point and Dial. *
;* ============================================================= *
;* NEW OPTIONS: Alt-c invokes CALCULATOR *
;* Alt-a invokes ASCII chart *
;* (both are available from menu as well) *
;*******************************************************************
;* Prism code is intended to serve as sample for anyone who *
;* wishes to develop applications using Mirror III and Prism. *
;*******************************************************************
;;;; Modification log ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; 9-88 added Calc.xts & Ascii.xts as "sub-scripts" ;
;;;; ;
;;;; 11-88 Will ignore commands to invoke Calc or ASCII if the ;
;;;; Script file is not present. ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
abort disable
sc t
cl
;;;; Check to see if PRISM is loaded
addin check prism.maf
if #=1 jump prism_is_loaded
LABEL ERR_ABORT
al 3n
me
[3,6] Note: In order to use Point-&-Dial, you must load PRISM.MAF. You
may load directly with the following Mirror command:
[h] Addin load prism.maf 1000 2000 1000 [n]
Alternatively, you may make the following entry in your [h]MIRROR.CFG
[n] file in order to have PRISM auto-loaded when you execute MIRROR:
[h] Addin = Prism.maf 1000 2000 1000 [n]
Remember that the sizes given above are suggested sizes only. The sizes
you should use will vary depending on the PRISM applications you wish to
use. Consult your PRISM manual for more information.
.
Box at 1,1 size 19,80 style 3 hollow
ask Press a key...
cl
sc s
end
LABEL PRISM_IS_LOADED
;;;; Be certain that enough savespace is declared
if (savespace > 2000) jump declarations
me
[17,5]Insufficient [h]savescreen[n] space is declared.
.
jump err_abort
LABEL DECLARATIONS
;;;;;;;;;;;;;;;;;;;;;;; VARIABLE DECLARATIONS ;;;;;;;;;;;;;;;;;;;;;
; The Array NUMBER is the circular buffer of the phone numbers ;
; dialed. NUM_INDEX is the pointer to the current buffer element. ;
; If the user does not change the pointer (see menu item D), the ;
; pointer will cycle through the buffer in circular fashion. ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
var int i, j, num_index, hot_key[5], key_press
var string number[10,40], ch[1], pth[50]
num_index = 1
hot_key[1]=keyval("alt-d")
hot_key[2]=keyval("alt-m")
hot_key[3]=keyval("alt-c")
hot_key[4]=keyval("alt-a")
pth = strip(value("do"),letter + ".& ",1)
;********************* ALL SYSTEMS GO! ***************************
LABEL FILEZ_EXIST
;;;; Go into background
mo c : bye : ;;;; PUT MIRROR IN READY STATE
ba go
at alt-0
foreground off
;;;; Display the opening "banner" (on DOS screen)
jump /r in_msg
;;;; Set up the help screen in advance to avoid run-time delays
jump /r help_setup
LABEL START
;;;; Wait inactive until a hot-key is pressed
i = hotkeys(-1,hot_key[1],hot_key[2],hot_key[3],hot_key[4])
on i jump get_number, menu, do_calc1, do_asc1
if (i = -1) jump bg_exit : ;;;; Background keys were hit
jump start : ;;;; Invalid key pressed
LABEL DO_ASC1
if -[@(pth)ASCII.??S] jump start
do @(pth)ascii
ba g
jump start
LABEL DO_CALC1
if -[@(pth)CALC.??S] jump start
do @(pth)calc
ba g
jump start
LABEL GET_NUMBER
;;;; Here we know an ALT-d was pressed
;;;; stop the foreground process and input the number
at alt-0
foreground off
num_index = num_index + 1
if (num_index > 10) num_index = 1
number[num_index] = winstring(row("d"),col("d"),40,"d")
number[num_index] = slice(number[num_index],1," ")
number[num_index] = strip(number[num_index]," ",3)
;;;; if the number isn`t null, dial it
if (len(number[num_index]) = 0) al 1n : Jump re-wait
jump /r dial_number
LABEL RE-WAIT
;;;; restart the foreground process & go back to waiting for hot-key
bye
foreground on
at esc
jump start
LABEL MENU
at alt-0
foreground off
;;;; Display the "exploding box"
savescreen 3,28,12,36,"d"
for i = 1 to 12
box at (9-int(i/2)),(28+(12-i)) size i,(3*i) style 4 color "wb" screen "d"
next i
saycolor = "wb"
say at 4,38; screen "d"; "POINT & DIAL MENU"
draw from 5,28 to 5,63 color "wb" style 2 ends chr(204)+chr(185) screen "d"
say at 7,30; screen "d"; " D - prompt for number to dial"
say at 8,30; screen "d"; " H - display help screen"
if -[@(pth)CALC.??S] skip 1
say at 9,30; screen "d"; " C - Use Calculator"
if -[@(pth)ASCII.??S] skip 1
say at 10,30; screen "d"; " A - Display ASCII chart"
say at 11,30;screen "d"; " U - un-install POINT & DIAL"
LABEL MENU_TEXT
say at 13,34 screen "d" color "wb"; " <RETURN> to exit menu ";
;;;; wait for key to be pressed
i = inkey(-1)
;;;; If i is one of the menu choices, jump to the right routine
ch = upcase(chr(i))
j=instr("ACDHU",ch)
on j jump do_asc2, do_calc2, dial_prompt, help_scr, out_msg
if (i <> keyval("return")) jump menu_text
;;;; i was <RETURN> so exit menu & restart foreground
restore
foreground on
at esc
jump start
LABEL DO_ASC2
if -[@(pth)ASCII.??S] jump menu_text
foreground on
at esc
do @(pth)ascii
ba g
at alt-0
foreground off
jump menu_text
LABEL DO_CALC2
if -[@(pth)CALC.??S] jump menu_txt
foreground on
at esc
do @(pth)calc
ba g
at alt-0
foreground off
jump menu_text
LABEL DIAL_PROMPT
;;;; Prompt for number to dial
box at 7,25 size 4,45 color "Wg" screen "d" save
say at 8,27; screen "d"; color "kg"; "Enter the number to dial:"
i = 1
;************* circular buffer ***********************************
repeat
;;;; erase previous field (if any)
form clear
;;;; display current field
field number[num_index] at 9,27 color "kw" only "01234567890,#*- "
form display screen "d"
;;;; accept input until a "control" type key is pressed
form accept i, key_press
;;;; if "control" key was an arrow, update the buffer pointer
if (key_press = keyval("up-arrow")) num_index = num_index - 1
if (key_press = keyval("down-arrow")) num_index = num_index + 1
if (num_index > 10) num_index = 1
if (num_index < 1) num_index = 10
;;;; Continue looping until the "control" key is <RETURN>
until (key_press = keyval("return"))
;*****************************************************************
;;;; Strip leading and trailing blanks
number[num_index] = strip(number[num_index]," ",3)
;;;; If number is not null, dial it. Then go back to menu.
if (len(number[num_index]) > 0) jump /r dial_number
restore
jump menu_text
LABEL DIAL_NUMBER
go l
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; NOTE: This command is for HAYES compatible modems. If you use ;
; some other type of modem, you will need to change this. ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
reply ATDT@(number[num_index]);|
saycolor = "Wy"
savescreen 9,16,10,37,"d"
box at 9,20 size 5,32 color "wy" screen "d"
say at 10,22;screen "d";"Now Dialing ";left(number[num_index],17);
say at 12,22; screen "d"; "Press RETURN when connected. ";
;;;; wait for any key
j = inkey(-1)
;;;; keep track of duration of call
i = seconds(time24)
box at 11,18 size 5,32 color "wm" screen "d"
say at 12,20; screen "d"; color "Wm"; "Call in progress...";
say at 14,20; screen "d"; color "Wm"; "Press RETURN when complete. ";
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; NOTE: These commands are for HAYES-type modems. If you use ;
; some non-compatible modem, you will need to change this. ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; Tell modem to hang up
reply +++
wa d 10
re ATH|
;;;; When a key is hit, calculate duration of call
j = inkey(-1)
j = seconds(time24)
i = j - i
;;;; display duration of call & exit the subroutine
box at 13,16 size 5,32 color "wr" screen "d"
say at 14,18; screen "d"; color "Wr"; "Duration of Call - ";time24(i);
say at 16,18; screen "d"; color "Wr"; "Press RETURN to continue ";
i = inkey(-1)
restore
rt
LABEL help_scr
;;;; Display help screen (on MIRROR'S Alternate screen)
cl /t
sc l kk
ba r
foreground on
sc a O
j = inkey(-1)
box at 2,2 size 23,78 style 0 color "kk"
me
[4,5][wk]Alt-M[gk] displays the Point-&-Dial menu:
[6,8]If you choose item [wk]D[gk], you will be asked to input a number which
[7,8]will be dialed, similar to using [wk]Alt-D[gk] (above). Point-&-Dial
[8,8]retains up to 10 previously dialed numbers in a circular buffer.
[9,8]When entering a number you may hit [wk]UP-ARROW[gk] or [wk]DOWN-ARROW[gk] to
[10,8]cycle through the buffer and select a previously dialed number.
[12,8]Choosing item [wk]H[gk] displays this help-screen.
[14,8]Choosing item [wk]C[gk] invokes a simple calculator.
[16,8]Choosing item [wk]A[gk] displays a chart of ASCII characters.
[18,8]Choosing item [wk]U[gk] causes Point-&-Dial to terminate, leaving
[19,8]you in your current application.
[23,28][WK][i] Press a key to exit...
.
j = inkey(-1)
;;;; Go back to menu
sc t 4
ba g
wait d 10
foreground off
sc l kw
jump /r help_setup
ju menu_text
LABEL help_setup
box at 1,1 size 25,80 style 0 screen "a" color "kk"
box at 1,1 size 25,80 style 3 color "kg" screen "a" hollow color "kg"
me /a
[1,15][kg]P O I N T - A N D - D I A L O P T I O N S[gk]
[4,5]Point-&-Dial has 4 "hotkeys": [wk]Alt-D[gk], [wk]Alt-C[gk], [wk]Alt-A[gk],
[4,56]and [wk]Alt-M[gk]:
[7,11]After installing Point-&-Dial, you may dial by positioning the
[8,8]cursor to the beginning of a number, and hit [wk]Alt-D[gk]. The number
[9,8]will then be dialed. When there is an answer you may pick up your
[10,8]phone and hit [wk]<RETURN>[gk] to hang up the modem. When your call
[11,8]is complete, hitting [wk]<RETURN>[gk] displays the duration of the call.
[12,8]As an example, you could create a directory of phone numbers in
[13,8]a text editor, and use Point-&-Dial as a quick method of selecting
[14,8]and dialing a number in your phone directory.
[16,11]The [wk]Alt-C[gk] hotkey invokes a simple calculator, and the
[17,8][wk]Alt-A[gk] hotkey displays a chart of IBM extended ASCII character
[18,8]codes, with their decimal and hexidecimal representations.
[23,28][WK][i] Press a key for page 2...
.
rt
LABEL in_msg
;;;; display the opening "banner"
timer off
savescreen 9,20,10,40,"d"
;;;; "Exploding box" (opens horizontally only)
for i = 1 to 8
box at 9,(20 + (9-i)) size i,(4*i) style 2 color "kw" screen "d"
next i
box at 9,20 size 10,40 style 2 color "kw" screen "d"
saycolor = "bw"
say at 10,22; screen "d"; "Point & Dial installed...Hot keys:"
saycolor = "Kw"
say at 12,22; screen "d"; "Alt-M"; " POINT-&-DIAL menu"
say at 13,22; screen "d"; "Alt-D"; " dial number at cursor"
if [@(pth)CALC.??S] say at 14,22; screen "d"; "Alt-C Calculator"
if [@(pth)ASCII.??S] say at 15,22; screen "d"; "Alt-A ASCII chart";
saycolor = "bw"
say at 17,22; screen "d"; "(Hit the space bar to continue)";
i = inkey(100)
restore
foreground on
at esc
rt
LABEL out_msg
;;;; display final "banner"
restore
at alt-0
foreground off
box at 7,18 size 8,36 style 0 color "wk" screen "d" save
box at 9,20 size 4,32 style 2 color "wk" screen "d"
say at 10,22; screen "d"; color "wk"; "Point-&-Dial terminated."
say at 11,22; screen "d"; color "wk"; "Uninstall MIRROR (y/n)? >";
LABEL KWAIT
i = inkey(-1)
number[1] = upcase(chr(i))
if (number[1] = "N") jump U1
if (number[1] <> "Y") jump KWAIT
restore
foreground on
at esc
ba r
qu
end
LABEL BG_EXIT
me [24,10]Background exited... Point-&-Dial terminated.
al 3n
at esc
rt
end
LABEL U1
say at 11,22; screen "d"; color "wk"; "MIRROR still in Background!";
;;;; wait 3 seconds or until a key is hit
i = inkey(30)
;;;; restart foreground process and exit script
restore
foreground on
at esc
bye
rt
end