Back to main page
Programs by Mike
Technical Writing by Mike
Graphic design by Mike
E-mail Mike

A WP8 template macro

I know you've probably heard about what a time waster Windows programs are in general. No doubt many MTs feel that WP8 is no different. I even remember seeing someone online say that she uses WP8 for pretty stuff but WP51 for production. Hopefully, this article will change that attitude.

Record that macro

The first step in making a template macro is to record the template the macro will produce. In WP8 we do this by holding down Ctrl-F10. Type a name for the macro you want to record and press Enter. Now start typing the format you need but use place holders where the demographics information will go.

Using the same format we used in the last article our finished blank document will look like this:

Valley Urgent Care

Patient Name: ptname whitespace whitespace whitespace Date: dtofvisit

S: *

O: *

A: *

P: *

                _______________________

                docname

D: dtime

T: ttime

#jobno

The place holders we used are ptname, dtofvisit, docname, dtime, ttime, and jobno. These will become our variables in the macro. The asterisks can be jumped to with a find and replace macro. So far everything is the same as it was in WP51. We are just using a different program.

Editing the macro

To edit a WP8 macro you need to go to the Tools Menu | Macro | Edit and then highlight the macro and click the Edit button. Once you've done that you'll notice that our WP8 macro looks a lot different from the WP51 macro we created earlier even though they do exactly the same thing. This is what your macro should look like:

Application (WordPerfect; "WordPerfect"; Default!; "EN")
Justification (Justification: Center!)
Type (Text: "Valley Urgent Care")
HardReturn ()
HardReturn ()
Justification (Justification: Left!)
Type (Text: "Patient Name: ptname")
Tab ()
Tab ()
Tab ()
Tab ()
Tab ()
Type (Text: "Date: dtofvisit")
HardReturn ()
HardReturn ()
Type (Text: "S: *")
HardReturn ()
HardReturn ()
Type (Text: "O: *")
HardReturn ()
HardReturn ()
Type (Text: "A: *")
HardReturn ()
HardReturn ()
Type (Text: "P: *")
HardReturn ()
HardReturn ()
Tab ()
Tab ()
Tab ()
Tab ()
Tab ()
Tab ()
Tab ()
Tab ()
Type (Text: "________________________")
HardReturn ()
Tab ()
Tab ()
Tab ()
Tab ()
Tab ()
Tab ()
Tab ()
Tab ()
Type (Text: "docname")
HardReturn ()
HardReturn ()
Type (Text: "D: dtime")
HardReturn ()
Type (Text: "T: ttime")
HardReturn ()
Type (Text: "#jobno")

The first thing to notice here is the very first line of the macro. That just says that the macro was created with an English version of WordPerfect. The next line we have is the Justification (Center!) command, this is no different than the [Center] command that we see in our WP51 macro except that centering in WP8 will stay on until you change it to something else. The HardReturn () and Tab () commands are self-explanatory.

The Type command is the new one. This command will take text in quotes and type it in the document. So the command Type(Text: "Valley Urgent Care") will type the words "Valley Urgent Care" in our document.

Getting text into variables

The next task is for us to tell WP to prompt us to enter our demographic information and store it in variables. We do this with the GetString command. This is the WP8 equivalent for the WP51 Text macro command. If we look up GetString in WP8's macro help we will see that it takes four possible arguments as shown below:

GetString (VariableName: variable; [Prompt: string]; [Title: string]; [Length: numeric])

Arguments in square brackets are optional. The first argument, VariableName, is the name of the variable that will our text will be assigned to. The second argument, Prompt, is the text that will tell us what to enter. The third argument, Title, is the name of the dialog that will appear. The last argument, Length, should not be used. This will limit the amount of characters that the user can input. If you did want to use Length you should only do so on dates and variables where you know the information entered will not exceed a certain number of characters.

A typical GetString command will look like this:

GetString (VariableName: ptname; Prompt: "Type the patient's name and press Enter or click OK."; Title: "Patient Name")

If the above command is run from a macro it will create a dialog box that looks like this:

The user will then type in the patient's name and when she presses Enter or clicks OK that text will be stored in the variable "ptname." Add one GetString command for each of the place holders in the template. GetString commands will play in the order in which they are placed in the macro. They should all be placed at the top of the macro but underneath the line starting with "Application." The beginning lines of the macro should look similar to this when you are done adding the GetString commands:

Application (WordPerfect; "WordPerfect"; Default!; "EN")

GetString (VariableName: ptname; Prompt: "Type the patient's name and press Enter or click OK."; Title: "Patient Name")

GetString (VariableName: dtofvisit; Prompt: "Type the date of visit and press Enter or click OK."; Title: "Date of Visit")

GetString (VariableName: docname; Prompt: "Type the doctor's name and press Enter or click OK."; Title: "Doctor name")

GetString (VariableName: dtime; Prompt: "Type the time of dictation and press Enter or click OK."; Title: "Dictation Time")

GetString (VariableName: ttime; Prompt: "Type the time of transcription and press Enter or click OK."; Title: "Transcription Time")

GetString (VariableName: jobno; Prompt: "Type the job number and press Enter or click OK."; Title: "Job Number")

Justification (Justification: Center!)
Type (Text: "Valley Urgent Care")...

This will show one GetString dialog after another, just like the TEXT command in the last article displayed one prompt message after the other. When you are done entering data the rest of the macro will start to play.

When the GetString lines are finished we will have all our demographic information placed in variables that are amazingly similar to the place holders we used to create the template. Coincidence? I think not!!

Putting variables into the document

Below I've isolated the lines in our WP8 macro that actually type text on the screen:

Type (Text: "Valley Urgent Care")
Type (Text: "Patient Name: ptname")
Type (Text: "Date: dtofvisit")
Type (Text: "S: *")
Type (Text: "O: *")
Type (Text: "A: *")
Type (Text: "P: *")
Type (Text: "________________________")
Type (Text: "docname")
Type (Text: "D: dtime")
Type (Text: "T: ttime")
Type (Text: "#jobno")

The quotes in the Type command tell WP to type what is there. If we eliminate the quotes WP will assume that we want to type the data stored in a variable. Thus we could edit the Type commands above to type the information we've stored in variables with the GetString command. Here's an example:

Type (Text: "Valley Urgent Care")
Type (Text: "Patient Name: " + ptname)
Type (Text: "Date: " + dtofvisit)
Type (Text: "S: *")
Type (Text: "O: *")
Type (Text: "A: *")
Type (Text: "P: *")
Type (Text: "________________________")
Type (Text: docname)
Type (Text: "D: " + dtime)
Type (Text: "T: " + ttime)
Type (Text: "#" + jobno)

Notice that the lines without place holders didn't change. But the lines with place holders did change. For instance:

Type (Text: "Patient Name: ptname")

Changed to:

Type (Text: "Patient Name: " + ptname)

In the first example we told WP to type the text "Patient Name: ptname". In the second example we told WP to type the text "Patient Name: " and also to type the data stored in the variable "ptname."

The finished macro should look like this:

Application (WordPerfect; "WordPerfect"; Default!; "EN")

GetString (VariableName: ptname; Prompt: "Type the patient's name and press Enter or click OK."; Title: "Patient Name")

GetString (VariableName: dtofvisit; Prompt: "Type the date of visit and press Enter or click OK."; Title: "Date of Visit")

GetString (VariableName: docname; Prompt: "Type the doctor's name and press Enter or click OK."; Title: "Doctor name")

GetString (VariableName: dtime; Prompt: "Type the time of dictation and press Enter or click OK."; Title: "Dictation Time")

GetString (VariableName: ttime; Prompt: "Type the time of transcription and press Enter or click OK."; Title: "Transcription Time")

GetString (VariableName: jobno; Prompt: "Type the job number and press Enter or click OK."; Title: "Job Number")

Justification (Justification: Center!)
Type (Text: "Valley Urgent Care")
HardReturn ()
HardReturn ()
Justification (Justification: Left!)
Type (Text: "Patient Name: " + ptname)
Tab ()
Tab ()
Tab ()
Tab ()
Tab ()
Type (Text: "Date: " + dtofvisit)
HardReturn ()
HardReturn ()
Type (Text: "S: *")
HardReturn ()
HardReturn ()
Type (Text: "O: *")
HardReturn ()
HardReturn ()
Type (Text: "A: *")
HardReturn ()
HardReturn ()
Type (Text: "P: *")
HardReturn ()
HardReturn ()
Tab ()
Tab ()
Tab ()
Tab ()
Tab ()
Tab ()
Tab ()
Tab ()
Type (Text: "________________________")
HardReturn ()
Tab ()
Tab ()
Tab ()
Tab ()
Tab ()
Tab ()
Tab ()
Tab ()
Type (Text: docname)
HardReturn ()
HardReturn ()
Type (Text: "D: " + dtime)
HardReturn ()
Type (Text: "T: " + ttime)
HardReturn ()
Type (Text: "#" + jobno)

Wrapping up

Here are some extras we could to this macro to save the user some time. We can use QuickCorrect and QuickWord abbreviations in our macros. They will automatically expand when the macro is played if you type a space after the abbreviation in the GetString prompt box.

For example, my date of dictation abbreviation is stored in a QuickCorrect entry as "yd" so when I type in the Dictation Time dialog I would type "yd " then Enter. You could also just add a space to the end of the Type command, like this:

Type (Text: "Date: " + dtofvisit + " ")

Another neat trick is to have the template automatically save the document. To save the current document to the path you want with the job number for the filename, you use the FileSave command:

FileSave(Filename: "c:\mypath\" + jobno)

This command can be placed at the end of the template macro or in a separate macro altogether.

(Final note: The techniques and commands outlined in this article are the same for WP6.1 for Windows and WP7.)

Copyright 1999 by Mike DeTuri (reprinted from Computer Solutions Vol. 1, Issue 3)