Letters Letters Letters

A letter for all occasions

By Jack Wheeler

Jack wants to manipulate Rich Text objects but discovers that there are no Xbasic methods to do so. This only stops him briefly. Using a technique which should be very familiar to former users of Alpha Four, Jack uses sys_send_keys() to send the keys he wants to Alpha Five. Later in the article he does some cutting and pasting with Alpha Five's mouse detection methods. You can reach Jack at jwl1@jps.net.
If you are interested in using Alpha Five with word processing, don't forget to read Finian Lennon's classic article on mail merging with Word.

The beauty of all database applications is the ability to do repeated duties FAST and easily. Alpha Five is wonderful with this. As I go day to day within my business and analyzing other businesses, there is a commonality (if you will) in the need to communicate with clients, members, or employees. You will always find all the pertinent information within the database itself, however, EVERYONE opens up Word and starts addressing a letter. Now I know there is a better way and you know there is a better way, but they don’t. Here are two of my samples I show people on how easy it really could be to do this.

First of all, Alpha Five has the best RICH TEXT memo field I have ever seen. With this new release of Alpha Five, it has become almost perfect. Once you start using this option you will never need to use any other word processor AGAIN. Yes, it is that good.

There is some work I have been doing for an insurance company where correspondence is the key to their existence (at least they say so). I noticed that they send out FAXES regularly throughout the day. What they did was go to Word and open up the fax template, type in the fields and print this out, then they would open their database next to word (side by side) and copy the name, address and city into the Word document and type their letter, print it out and then fax the two documents. Overall time roughly five minutes:

My solution:

Figure1

Fig. 1- fax worksheet

I have designed global variables that read the current record's information. I have set this up to be as close to automatic and routine as possible. Every form has this built into it. Therefore as you go to print a letter or fax coversheet the information will be readily available.

Here is the finished Fax coversheet:

Figure2

Fig. 2. Fax coversheet

The fax coversheet takes literally 32 seconds to complete and print. Now for the letter, here is a typical worksheet we call Custom Letterhead. Here it is:

Figure3

Fig. 3. Custom letter worksheet

All that is needed on this form is to type your comments and then simply print it out! This whole process takes under 2 minutes. (We also have a Rich Text field in most tables where the user can simply type a note in the current record and hit the print button to print the letter.)

I find there is a need to communicate to people on a professional level through letters. Therefore, if you find yourself typing similar letters over and over again, you can create your own template letter and print that out as you see fit.

As an example, this kind of form allows you to easily accomplish this task. It works very well.

Figure4

Fig. 4. Letter choice list

NOW here is the best of the best!

One of my clients is not very good with the computer. As a matter of fact he has a hard time opening Word. When I showed him some of my letter Ideas, He started to turn BLUE! I knew I was in trouble. He looked at me and said, “I will only type one of these three letters (which he handed me) but, I often combine paragraphs from one letter to the next.” He did this with no rhyme or reason.

It then dawned on me to develop a form where he could just double click on a paragraph and Alpha Five would move that paragraph into a letter. Easier said than done? Well, here it is:.

Figure5

Fig. 5. Variable paragraph letter

What I did was break the paragraphs up into segments. Each segment is separated into colors so that my client could easily find the text he wanted (you will note that a 3 line summary is shown to help with this. Let me explain the form to you.

The far right top of the form has two buttons, one called Clear letter and the other called Change font color. The codes are listed below. It is obvious why the clear letter button is there for, however you might ask what the font button is there for. My client uses a color printer and wants the fonts to appear only in black. Therefore I had to design something to accomplish this for him.

One problem with Rich Text fields is that there are no methods to manipulate them in Xbasic, therefore, I could only use the Sys_send_keys() function to imitate an invisible user making menu choices. This method works very well:

'Clear letter
ui_freeze(.t.)
parent.commit()
dim f as p
f=topparent.this
dim t as p
t=table.current()
t.change_begin()
t.custom=""
t.change_end(.t.)
topparent:form1.refresh()
f:end.activate()
ui_freeze(.f.)
'Change font color to black
ui_freeze(.t.)
dim f as p
f=parentform.this
f:form1.activate()
sys_send_keys("{Alt-E}a{Alt-T}p{Tab}a{Down}{Down}\
{Down}{Down}{Tab}10{Tab}{Tab}{Tab}{Tab}{Tab}{Tab}{Home}{Enter}")
f:end.activate()
ui_freeze(.f.)

If you look at the keys you will note that you can simply open the edit on the menu bar, and then select the font you want and then the color. My client had a hard time turning on the computer.

Now here is the form in design mode, you will see the user objects over each paragraph. This is where the on mouse commands can take hold.

Figure6

Fig. 6. Paragraph form design

Here is the code on each user object. It simply selects the text copies the text and paste the test to the letter body.

if a_user.mouse.event="Left Double Click" then
 ui_freeze(.t.)
 dim f as p
 f=topparent.this
 f:toofar9.activate() ‘paragraph 9 activate
 sleep(1/10)
 sys_send_keys("{Alt-E}A{Alt-E}C") 'copies paragraph 9
 f:form1:custom.activate() 'letter body activate
 sys_send_keys("{ctrl-end}{enter}{enter}{Alt-E}P") 
 'Letter body paste
 f:user9.activate() 
 'activate user object 9, matches paragraph number
 ui_freeze(.f.)
end if

As you can see there are many ways to use letters and forms in Alpha Five. Just keep an open mind and try to make life as easy as possible for the user and you will accomplish wonderful things!

Ideas for automatic letter sending:

Click here to download these example letters and scripts!

12/12/99

Don't forget, we need your feedback to make this site better!

Return to home