12. NS BASIC TechNote - How to Dial using NS BASIC        August 30, 
1995          
--------------------------------------------------------------------------
Recently I was in rural France and wanted to check my voicemail. Easy,
I thought. But then I discovered the local phones all used pulse dialing
and could not generate the tones I needed to control the voicemail.

My Newton and NS BASIC come to the rescue. The following program puts 8
buttons on the screen which generate the various tones I need to control my
voicemail.

The program uses the RAWDIAL(,'speaker) function, which
isn't in the NS BASIC handbook.

Note the use of the new WSTAT variable to determine the window clicked
on. This feature is available with NS BASIC 2.5.


0010 rem control voicemail -- dialer
0020 LET windows:=8
0030 LET f:={viewbounds: {left: 10, right: 220}, viewjustify: 2,
viewformat: 0}
0031 LET f.viewformat:=Vfframeblack+4*vfround+2*vfpen
0040 LET ht:=floor(220/windows)
0050 cls
0060 dim w[windows],wf[windows]
0100 for i=0 to Windows-1
0105   LET wf[i]=f
0110   read wf[i].text,wf[i].dialstring,wf[i].goto
0150   LET wf[i].viewbounds.top:=i*ht
0160   LET wf[i].viewbounds.bottom:=i*ht+ht-5
0170   window w[i],wf[i]
0180   show w[i]
0190 next i
0200 rem wait for event
0210 wait 10000
0220 GOTO 0200 //wait for event
0500 rem get
0505 data "Calling Card #","888 555-1010 1234",2000
0510 data "Voice Mail 1","#555-1212 1234",2000
0515 data "Voice Mail 2","#555-1313 1234",2000
0520 data "play/rewind","1",2000
0530 data "fast forward","3",2000
0540 data "delete","7",2000
0550 data "save","9",2000
0560 data "quit","",9000
0590 return
2000 rem do it
2010 wait 100
2020 LET x=rawdial(wf[wstat].dialstring,'speaker)
2030 GOTO 0200 //wait for event
9000 rem fin
9010 hide
9030 end