Home | Tips | Library | Other Authors | Other WP Sites | Writer's Links | Contact | Site Map | Donate |
![]() Toolbox for WordPerfect |
||
Macros, tips, and
templates for Corel® WordPerfect® for Windows® |
Page updated Apr 12, 2020 |
|
Macros that
quickly produce either - • a short signature or other "fill in" line (◄- like this) • or a line up to the right margin, like this: • or text centered between margins with automatically adjusted lines, like this: TITLE |
||
Relates pages - • Tab settings in WordPerfect • An alternative method to the macros on this page that can create underlines that vary in width depending of the amount of text on the line: |
Purpose ► The following macros are based on a combination of these WordPerfect features that you could use yourself from the WordPerfect menu: • Format, Font, Underline (the top tab), Text & Tabs However, you might find these macros more
useful, since they are fast, easy to use — and they also reset your current
setting for underlining (first feature above) following the location where they were applied.
► All three individual macros are included in the download (ZIP) file: • UnderlineTab.wcm (v1.01) - A macro that creates an underlined tab space. Each activation
produces another underlined tab, up to the right margin.
It is useful to
quickly create a signature line or similar short line below the text's
baseline.
Note
You can create the tabbed underlines and then type over them. But in that case they will also expand rightward as text is added past the last underlined [Tab] code. (Use Reveal Codes to see what is going on at the cursor location.) However, this should not happen often since the main purpose of the macro is to create a short, fixed length line that will be used on the printed document. • Underline2Margin.wcm (v1.01) - A macro that creates an underline from the current cursor position — i.e., after the last text character on a line — up to the right margin to "fill" the space with a line. It then (optionally) enters a hard return [HRt] and (optionally) returns the cursor to the starting point. This allows the line to automatically expand or contract if previous text on that same line is edited. It is useful (for example) to create a section divider that visually separates a description from following text.
A small caution ...
Underline2Margin was designed to work
with regular body text. It does not work as intended when the cursor is inside a character style or a paragraph style such
as Heading 1 - Heading 5 (or other paragraph styles).
If it is played in such an applied style it can underline everything in that style — margin to margin — instead of underlining just from the end of the style's text up to the right margin. This is program issue, not a macro issue, whenever some text attributes like underlining are applied at the very end of the style's text (i.e., just before the ending [CharStyle] or [ParaStyle] code). Solutions...
If that happens, you can
1. Undo the macro's changes immediately with Ctrl+Z.
[If for some
reason this doesn't work — e.g., you are in a later WordPerfect
session — you can delete the [Undrln Tab][Hd Flush Right] codes from
the style's
text in Reveal Codes, then double-click on the [Style] code to
remove the [Und] code from inside that [Style] code.]
2. Type (or paste) the text before applying the style, then play the macro to create the underlining; then select the text and apply the style to it. Note By design, if the new underline is created on the
last line of a page, it will not cause a new page to be generated. [Any
(optional) hard return at the end of the underlined area is removed.]
Tips • If you do not want the cursor to return
to the beginning of the current underlined area, and/or you do not want
a hard return entered at the end of the underlined area, you can change
these defaults in the macro's redlined User Modification Area.
Just open the macro file for editing with Tools, Macro,
Edit and make your changes in that modification area to one or both
variable assignments located there; then click the Save & Compile
button on the macro toolbar.
• You can use this underline-to-margin format to (e.g.) create a watermark with a column of underlines on one side of the pages so they will appear adjacent to, and aligned with, the lines of text on the other side of the pages. [Screen shot] This can be useful for adding written comments to the printed document during editing. See the macro in Footnote 1. • Underline2Center.wcm (v1.0) - This macro creates a "expandable underline" from the current cursor position (usually, the beginning of a new line) to the center position (i.e., between both margins) and thence to the right margin (i.e., the end of the current line). It then optionally enters a hard return and returns to the center of the line, where text between the underlines is entered via a pop-up dialog (the dialog itself can be suppressed). It is useful in
creating unique section headings and similar items, especially since
the lines adjust automatically to the width of the centered text.
Tips
• If the new underlines are created on
the last line of a page, it will not cause a new page to be generated.
[Any (optional) hard return at the end of the underlined area is
removed.]
• If you do not want a hard return entered at the end of the second underlined area, you can change this and several other defaults in the macro's redlined User Modification Area. • Once the item is created, you can add text to the very beginning and/or very end of the line by moving the cursor (in Reveal Codes) before the first [Und] code and/or after the last [Und] code. This produces left-center-right text joined by underlines. ► A separate underline format option from the macros above:] A standard program feature lets you underline individual words only. The same Underline feature (i.e., Format, Font, Underline) used in the above macros can also be used to underline individual words in a selection of text (i.e., not underline any spaces or tabs).
When you use that menu setting and choose "Text Only" the program adds a special paired format code around the selected text (in addition to the underline codes), something like this:
[Und][Undrln Space: No] ... sample text ... [Undrln Space: Yes][Und]
Open Reveal Codes to see these codes, which can be deleted there if desired. Note, however, the style of the underlines (solid, dashed, etc.) is set separately from either Format, Font, Underline dialog or with the dedicated button (U) on the Text property bar. Alternatively, here's a small macro to quickly apply this type of underlining. It can be assigned to a toolbar button or a keyboard shortcut, as explained in the Tips section below. [To copy this code into your WordPerfect program to create a working macro see here.] // Macro code begins here
// This adds the special code [Undrln Space: No] .. [Undrln Space: Yes] // around selected text. The style of the underline (solid, dashed, etc.) // is set separately from the button (U) on the Text property bar, or from // the Format, Font, Underline (tab) dialog. If(?BlockActive=False) Messagebox(;"Underline text ONLY (not spaces or tabs)"; "You must SELECT some text first!"; IconInformation!) Quit Endif UnderlineTabs (State: No!) UnderlineSpaces (State: No!) AttributeAppearanceOn(Underline!) SelectOff Quit // Macro code ends here Tips ► The macros above can be assigned to toolbar buttons or keyboard shortcuts. For example, to use a toolbar to play the macro:
• Edit your toolbar or property bar and create buttons to play the macros: [1] Right-click the toolbar or property bar
where you want to place the buttons.
[2] Choose Edit from the drop-down context menu, then click the Macros tab, then click the Add Macro button. [3] Choose the name of the macro from the file dialog that opens. Click Select. Note: Generally, you can answer "No" to "Save
macro with full path?" if the macro file (*.wcm) is located in your default or supplemental
macros folder. If it is not, answer "Yes."
A (default) gray "audiocasette" icon appears on
the right side of the toolbar or property bar.
[4] With the tool- or property bar's Editor dialog still open, right-click the new icon to open the Customize button dialog. Customize the icon with some descriptive text and a tool tip. [5] Click OK twice to return to the main document window. Repeat the above steps for the other macros. [For more details on assigning a macro or program feature to a toolbar or keyboard shortcut see the toolbar buttons or keyboard pages.] • Next, (optionally) change the button's default icon. Note: The methods you can use to change the icon image depend on your version of WordPerfect. See "How to change those default "audiocassette" icons on toolbar buttons after assigning macros to them (or change any toolbar icon)" here.
|
|
Footnote 1 [Continued from the Underline2Margin section above...] The macro code below is based on the Underline2Margin macro above. When played it creates a relatively narrow column of underlines inside a previously created watermark in the document. Here's an example of the result, showing a portion of two pages of text: ![]() This format can be useful for adding written comments to the printed document during editing. The underlines displayed via the watermark should follow the same vertical alignment as the lines of text in the body of the document, and they will continue in the document (unless discontinued - see Tips below). Instructions The following assumes left/right page margins in the document are set to 1.0", but they can be set differently — in which case you probably will need to adjust the margins in the watermark (see Tips below). First, in the main document text area set the right page margin to 4.25" (see Format, Margins, Right: 4.25", OK). All document text should now be in a single narrow "column" on the left side of all pages (see image above). Second, on that page create a watermark (either A or B — your choice). Third, while in the new watermark window, play the macro. (Note that it uses a 4.5" left page margin setting, but you can use whatever value you wish.) To copy this code into your WordPerfect program to create a working macro, see here. // Macro begins here // Creates a "column" of underlines from the left margin to // the right margin, from the page top to the page bottom. // // Set the left margin where the "column" of lines should begin: vLeftMarginSet:=4.5" // MessageBox(vAns;"Make a column of underlines up to the right margin"; "This macro should be played inside a"+NToC(0F90Ah)+ "WATERMARK (A or B) for best effect."+NToC(0F90Ah)+NToC(0F90Ah)+ "Do you wish to continue?";YesNo!|IconQuestion!) If(vAns=2 or vAns=7) Quit Endif // 'Cancel' or 'No' If(?CurrentSubDoc<>{7;8}) // (i.e., Not in a watermark structure) Messagebox(vAns;;"You are not inside a watermark."+NToC(0F90Ah)+ "Do you still want to continue?";YesNo!|IconQuestion!) If(vAns=2 or vAns=7) Quit Endif // 'Cancel' or 'No' Endif // Determine the current Format> Font> Underline choices; "remember" them // with flags; then turn ON the settings to underline tabs and spaces - If (?UnderlineTabs = True) vUndTabsFlag:=1 Else vUndTabsFlag:=0 UnderlineTabs (Yes!) Endif If (?UnderlineSpaces = True) vUndSpacesFlag:=1 Else vUndSpacesFlag:=0 UnderlineSpaces (Yes!) Endif // Start at the top: PosPageTop MarginLeft(vLeftMarginSet) vPg1:=?Page // Insert separate lines up to the right margin: While(True) // Turn underlining ON, add a flush right code: AttributeAppearanceOn (Underline!) FlushRight // Skip past the last [Und] code, enter a hard return PosCharNext HardReturn // If cursor is on the next page, go back a page: vPg2:=?Page If(vPg2>vPg1) DeleteCharPrevious Break Endif Endwhile // Reset user's default Format> Font> Underline choices - If (vUndTabsFlag = 0) UnderlineTabs (No!) Endif If (vUndSpacesFlag = 0) UnderlineSpaces (No!) Endif // Exit macro here: Display(On!) Messagebox(;"Finished"; "You can Close the Watermark now from the"+NToC(0F90Ah)+ "property bar -or- with File> Close.";IconInformation!) Return // Macro ends here Tips ☼ You can adjust the width of the column of underlines by editing the watermark and drag the margin guidelines leftward or rightward to make the underlines column wider or narrower. Alternatively you can just specify a different value for the left margin near the top of the macro code above. ☼ You can discontinue the watermark further into the document to stop the lines with Insert > Watermark > (choose the watermark you used) > Discontinue. Footnote 2 [...continued from above:] Here is an alternative, manual method to the macros described above that can create underlines that automatically vary in width depending of the amount of text on the line. It does this by adjusting a setting for WordPerfect's "dot leaders" so that the "dots" are transformed to underscores (without spaces). The method requires a temporary and somewhat unintuitive setting in the current document, typically made at the top of that document so that it will affect the following material in that doc. Here's how: [1] Place the cursor where you want the method to become effective -- typically at the very top of the document's text editing area. Note that the new leader characters will automatically replace any existing leader characters further down in the document.
[2] Click Format, Line, Tab set. This opens the Tab Set dialog. (Yes, that's correct!) [3] Type an underscore character (_) in the "Dot leader character" box, replacing the existing "dot" character there. (Tip: You can also use a character symbol inserted from the symbols dialog (Ctrl+W).) [4] Type a "0" (zero) in the "Character spacing" box, replacing the "1" there. [5] Click Set, then Close. Notes:
This inserts a new [Dot Lead Char] code -- visible in Reveal Codes -- in the document at the cursor location. You can delete that code if you want to restore any of the default "dots" in dot leaders further down in that document. [6] Use
any of the dot leader features in WordPerfect such as Format, Line,
Flush Right with Dot Leaders at the end of any word or short phrase;
you should then see an "underline" appear up to the right margin.
Done!Adding or deleting text on the line that has dot leaders will cause the program to automaticallyadjust the length of the underline. This method will also affect any other subsequent "dot leader" feature, such as hard tabs with dot leaders and centered text with dot leaders, used in that document. [-Originally posted in a footnote here.] |