home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 3 Comm
/
03-Comm.zip
/
tlcadr03.zip
/
address.doc
next >
Wrap
Text File
|
1996-01-26
|
11KB
|
230 lines
Description: (Address.Exe - v 1.07 - built 1/1/96 (TLCADR03.ZIP))
This program maintains up to 300, 60 byte address lines (actually
they could be any group of text lines you need to copy and paste
often!) in a plain ASCII text file. The text file can be one you
started, or have maintained manually, with an editor. --[More about
the file's format, later]-- It's name is (arbitrarily) ADDRESS.DAT
and it resides in the directory from which you launch ADDRESS.EXE.
If such a file does not exist, the first time you execute the
program, an empty one will be created.
The first time you execute the program it will position itself at
the upper right-hand corner of the screen. You can move it from
there if you wish. If you move the window, the program will
remember where you positioned it and will return to that position
for future executions. The guts of the program are controlled via a
dialog box that pops up when you double click on the client window
with mouse button #1.
Installation:
Unzip the file (oh, you already did that or you wouldn't be reading
this). Copy Address.EXE and Address.ICO to any directory you
choose. It doesn't care where you put it.
Execution:
Type [ Start /f {d:\path\}Address.Exe ] at any command line, or
create a desktop program object to start the program. The '{}'
indicate that the drive and path are optional depending on where you
put the program, what's in your path statement and what the current
drive and directory are when you issue the 'Start' command.
The program will create a file named 'ADDRESS.DAT' in the same
directory you executed it from, unless a file of that name already
exists. It will also create a file named ADDRTLC.INI, in the same
directory. This file holds any setup instructions the program
needs, like where the window is to be presented. When you double
click the client area of the program's window, a dialog box will pop
up. It has a drop-down combo- box, 7 push-buttons, 3 radio-buttons,
2 edit fields and an automatically updated use count field in it.
Let's start by putting a new line into the file. Just type the name
into the combo-box's edit line and press the Add button. The line
will be added to the combo-box and written immediately to the file.
If the name was in the clipboard (you copied it from some other
program) just press Shft+Ins or press the Paste button and the line
is pasted into the edit line.
You will notice, at the bottom of the dialog, an edit field labeled
"Name" and another labeled "Comment". These fields are directly
linked with the line in the combo-box's edit field (BUT, only if
that line is actually in the file). They may be directly edited at
any time and the changes will be saved in ADDRESS.DAT. However,
these changes are not saved in the file immediately. They are saved
with the next Add or Delete, or when the program is ended.
You'll notice that as you scroll, vertically, thru the combo-box,
these fields will change showing the values associated with each
address.
If you type a new entry into the combo-box's edit field, enter text
into the Name and/or Comment field and then scroll thru the
combo-box BEFORE you have Added the entry, what was in Name and/or
Comment is lost! However, you may enter Address, Name and Text and
then press the Add button. In this case, all three are added at
once.
To delete a line from the list, select the line from the drop-down
list so that it's in the edit line, and press the Delete button. It
is deleted from the list and the file, immediately, but is left in
the edit line, just in case you made a mistake and want to re-add
it!
To change a line, select it, do a Delete, change the edit field, and
do an Add. You may want to do this in reverse sequence, if you
worry that something could get lost through a finger-fault<g>. Just
remember that the value in the combo-box's edit field is treated
just like the key field in a database. All the other fields are
dependent on the key.
To select a line to be pasted into another program, select the line
from the drop-down list and press the Copy button. A copy will be
put in the clipboard and the dialog is dismissed. You will notice a
heavier border around the Copy button, indicating that it is the
default. When you press the Enter key, the Copy button is pressed
automatically. Also, you don't have to open the drop-down list.
You can use the Up and Down arrows to scroll the list thru the edit
line.
The Cancel button dismisses the dialog without making any changes to
the list, file or clipboard. HOWEVER, it is not an Undo button. If
you have made previous changes, they remain made.
The radio buttons (Name, Address and Count), in the 'Sorted by'
group box, immediately control the sequence in which the addresses
are presented in the combo-box. When you click one of the buttons,
the program first remembers which record was displayed in the
combo-box edit line and then sorts and reloads the combo-box's
dropdown list. It DOES NOT rewrite the file with the new sequence.
That will be done when the program ends, to avoid additional
overhead. Finally, it redisplays the original record in the
combo-box's edit line, so that even though the sequence has been
changed, you are still positioned on the same record.
There is a slight twist to the sorting in Name and Count sequences.
I hope this is acceptable to you<g>. In Name sequence sorting, the
records are also sorted, secondarily, in Address sequence. Thus, if
a record has no Name field, or if two records have the same Name
field value, they are ordered by Address. In Count sequence
sorting, the records are sorted in reverse Count value (largest
number, first) then in Name and finally in Address sequence.
The program opens, processes and closes the file for each change
made. It does not lock the file 'Open'. So, you can make changes to
the file with an external editor, if you want, while the program is
executing. To make those changes current, open the dialog and press
the Refresh button. The program will flush the list, open the file,
re-build the list and close the file.
A side benefit, in some circumstances, of the Refresh button, is the
ability to recover from changes made to the Name or Comment fields
before they have been physically saved to the file. Another subtle
"save yourself" will be discussed under the Merge button topic<g>.
As a (partial) safeguard to data loss, any time the program rewrites
the file, it follows these steps:
Write the new file, named ADDRESS.TMP
Delete a file named ADDRESS.BAK
Rename ADDRESS.DAT to ADDRESS.BAK
Rename ADDRESS.TMP to ADDRESS.DAT
If you should get a sudden 'black-spot' in power while all this is
occurring, when you finally get back alive, there should be at least
one of these files remaining! So, you have some chance of getting
back alive with as little loss as possible. Also, you normally have
the current copy of the file and one backup copy.
A final nicety; since the drop-down list is maintained in sequence,
the first time you make a change to the list, your file will be
re-created in sequence. So, if you have an existing file, in random
sequence, it will wind up in sequence the first time you make a
change!
The Merge button pops up a filename dialog, lets you select a
filename and merges all non-duplicates from that input file into the
current list. It then updates the ADDRESS.DAT file, using the same
write method outlined above. This gives you an easy way to keep two
address files (like at home and at work) in synchronization.
If you should accidentally delete a record from the file (and
immediately realize what you did<g>), you can "Merge" the
ADDRESS.BAK file back into the current file. That will restore the
deleted record!
Window position remembering:
The .INI file is only updated when the program is closed (you close
it, or shut the system down while the program is active). However,
that introduces a problem if the window is minimized when the
program is closed.
So, it remembers where the window was positioned the last time it
was 'painted' before it was minimized. 'Painting' only occurs when
some portion of the window was 'covered' and is now 'uncovered', not
when it's 'on top' and you move it. To make a long story short, if
you put the window in a new place, be sure to close the program with
the window visible, not minimized. That way, it can remember
exactly where it was.
File Format:
The Address.Dat file is a plain ASCII text file that you can change
or create with any text editor. Each line in the file is a record.
The fields are positional, variable in length and separated with a
single tilde (~) character. Missing/vacant fields are held by a
single blank. The fields' positions are:
1. Address
2. Name
3. Comment
4. Count
Following are some examples:
zeichick@acm.org~Alan Zeichick~OS/2 Magazine Editor-in-Chief~1
Iain Allen~Iain Allen~ ~2
aimgames@xmission.com~ ~ ~0
Notice how missing fields are treated. If you create/change a file
incorrectly with an editor, the program will attempt to use every
record. However, fields following the Address may not be
interpreted correctly. Each of the first three fields can be up to
60 characters long.
Cost:
This program is Freeware. It is 32-bit, thus requires OS/2 2.0+. It
was created with CASE:PM and the IBM C Set++ compiler and Toolset
(it's a tiny bit smaller than the previous version, a plug for
the optimization ability of C Set++ <g>).
Please try it, pass it along to your friends and upload it to your
favorite BBS. Its predecessors have traveled all around the globe
and I hope this iteration will, as well.
If you like it, or even if you don't, drop me a note at one of the
following addresses to let me know. I love mail. Who knows, if you
have a suggestion, I may even change the program, yet again!
US Mail: Tom Carr
5403 Pearce Way
Crestwood, KY 40014
ILink OS/2 conference: Tom Carr
Internet: tom.carr@tfd.org