home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Black Box 4
/
BlackBox.cdr
/
editors
/
hsevlsfx.exe
/
ADDRBOOK.HYP
< prev
next >
Wrap
Text File
|
1992-02-15
|
5KB
|
248 lines
.HEADER
┌─────────────────────────────────────────────────────────────────────┐
│ ADDRESS BOOK DATABASE $1~C45$2~C73│
└─────────────────────────────────────────────────────────────────────┘
.REMARK Address Book Database example
This shows a simple flat file database, with form fill data entry
and formatted lists.
.
.SCRIPT SETUP
-- allow for re-entry
O#
-- F10 puts back a 'q' - can't allow direct exit from data entry
KF0ZUq
-- set up read mask for formatted list
KG5:NAIKQZWYPTER
-- default selection expression is 1 - this is always TRUE of course!
VS1
-- set up default display mask
KG7[%c] $$A $$I ~A$$N~PP$$E~K%c~E~C25$$K $$Q $$Z $$W
.
.FRAME Database
.TITLE Control menu
[e] ~FData entry~Ke~E - Add records
[l] ~FData look up~Kl~E - Look for records by surname
[f] ~AFormatted address listing~Psaddrlist~Kf~E - select item to display notes field
[t] ~ATelephone number listing~Pstellist~Kt~E - select item to display notes field
[s] ~FSort records~Pssort~Ks~E - using MSDOS SORT program
[p] ~FPrints~Kp~E - Various listings
[q] ~AQuit~PQ~Kq~E - to MSDOS
.
.SCRIPT sort
-- sort database file using MSDOS SORT command
pSorting database - please wait
-- 'silent' program (hopefully)
d sort < addrbook.dat > addrbook.srt
-- copy back the output
dcopy addrbook.srt addrbook.dat
-- ring that bell
pReady
.
.SCRIPT addrlist
-- show note for input of expression
nSelection Expression
-- set up selection mask
KG6$S
-- and format line
KG7[%c] $$A $$I ~A$$N~PP$$E~K%c~E~C25$$K $$Q $$Z $$W
-- display formatted list and execute result
A@Gaddrbook.dat
.
.SCRIPT tellist
-- Telephone list
-- allow input of expression
nSelection Expression
-- set up selection mask
KG6$S
-- and format line
KG7[%c] $$A $$I ~A$$N~PP$$E~K%c~E~C30$$T
-- display formatted list and execute selected result
A@Gaddrbook.dat
.
.NOTE Selection Expression
Enter selection expression in HyperShell form
eg. "T0625"c - Telephone number contains 0625
"ADr"e ! "AProf"e - Title 'Dr' or 'Prof'
[ Enter 1 to select all records ]
Expression: ~I$S~W34~PVS%s~E~Q
-------------- Fields -------------------
A Title I Initials N Name
K Company
Q Addr 1 Z Addr 2 W Addr 3 Y Addr 4
P Postcode
T Telephone E Details R Date
.REMARK
This has an immediate reference to open the file for extending
.FRAME Data entry
.TITLE For entering data
~A~Pwaddrbook.dat+~E~Q~H Open database for extend
Title: Initials: Name:
~I$A~W5~PVA%s;I~Kt~E ~I$I~W6~PVI%s;I~E ~I$N~W30~PVN%s;I~E
Company:
~I$K~W30~PVK%s;I~E
Address:
~I$Q~W30~PVQ%s;I~E
~I$Z~W30~PVZ%s;I~E
~I$W~W30~PVW%s;I~E
~I$Y~W30~PVY%s;I~E Postcode: ~I$P~W10~PVP%s;I~E
Telephone: Notes: Date:
~I$T~W20~PVT%s;I~E ~I$E~W20~PVE%s;I~E ~I$4~W11~PVR%s;sinform~E
[ESC] Press escape to cancel entry - select field to edit
[w] ~APress 'w' to write record~Pswrite~Kw~E
[n] ~APress 'n' to clear fields and start new entry~Psclear;ZUt~Kn~E
[q] ~AQuit entry~Pw;F~Kq~E~H Close database
.
.SCRIPT write
-- write a record - simply intersperse variables with : character
W$N:$A:$I:$K:$Q:$Z:$W:$Y:$P:$T:$E:$4
-- tell user
pRecord written for $A $I $N
-- position mouse at col 20 line 20
ZX20;ZY20
.
.SCRIPT clear
-- clear all variables
VA;VN;VI;VK;VQ;VZ;VW;VY;VP;VT;VE;VR
-- refresh screen
y
.
.SCRIPT inform
pSelect field to edit or press 'w' to write record
ZX20;ZY18
.
.REMARK
A Title
I Initials
N Name
K Company
Q Addr 1
Z Addr 2
W Addr 3
Y Addr 4
P Postcode
T Telephone
E Details
R Date
.
.FRAME Data look up
.TITLE For displaying data
~A~Praddrbook.dat~E~Q~H Open for reading
Name: $A $I $N
Company: $K
Address: $Q
$Z
$W
$Y
Postcode: $P~C40
Telephone: $T~C40
Notes: $E Date: $R
[ ] ~APress space bar for next record~Psnext~K ~E
[f] ~APress 'f' to go to first record~PVk;sLookup~Kf~E
[l] ~I$k~W20~PVk%s;sLookup~Kl~E Lookup - enter start of name
[q] ~AQuit lookup~Pr;F~Kq~E
.
.SCRIPT Lookup
-- clear error status
Y
-- look up record starting with lookup string in variable k
Vr!L$k
-- if error set, output message
jsNOT FOUND
-- expand input variable e into fields
er:NAIKQZWYPTER
-- refresh and quit
y;q
-- nothing found
LNOT FOUND
-- insert text on screen
i~X10~Y20~DPNot found~DT
.
.SCRIPT next
Y
-- read into variables
R:NAIKQZWYPTER
-- if EOF, indicate end of file
jsEOF
-- refresh and quit script
y;q
-- End of file label
LEOF
i~X20~Y20~DPEnd of file~DT
.
.REMARK example printouts
.
.FRAME Prints
.TITLE Detailed and simple lists
[l] ~ASimple List~PsList~Kl~E
[a] ~AAddress List~Psadds~Ka~E
[d] ~ADetailed print~PsDetail~Kd~E
[q] ~AQuit to main menu~PF~Kq~E
.
.SCRIPT List
-- tell them to ready printer, throw result away
Y?Ready printer
-- output to printer
O51
-- open data file
raddrbook.dat
-- Loop start
LREAD
-- clear error status
Y
-- read record
R:NAIKQZWYPTER
-- if end of file, branch
jsEOF
-- print out a few fields
o$A $I $N $K
-- loop back
JREAD
-- here at end of file
LEOF
r
.
.SCRIPT adds
-- Address list
Y?Ready printer
O51
raddrbook.dat
LREAD
Y
R:NAIKQZWYPTER
jsEOF
o$A $I $N
o$K
o$Q
o$Z
o$W
o$Y $P
o
JREAD
LEOF
r
.