Home | Tips | Library | Other Authors | Other WP Sites | Writer's Links | Contact | Site Map | Donate |
Barry MacDonnell's Toolbox for WordPerfect |
||
Macros, tips, and
templates for Corel® WordPerfect® for Windows® |
Page updated Sep 4, 2021 |
|
FILENAME STAMPING macros that put the document's path, filename, and optional text on every page in the footer or header of your choice, or just on the last page of the document | ||
Macros with a similar purpose: DocStamp - A macro that will toggle the display of a user-specified document text stamp—such as "DRAFT" or "COPY"—on and off. EdgeText - a macro that places a short block of text, the date, and/or the filename at one of six places around the edge of the page, outside the page margins. DateRepl - Macros that can change all Date codes (dynamic dates) to text (static dates) See also: QuickWords for another way to insert items in a document. |
Two macros are included in the download Zip file: FilenameStamper.wcm Purpose and advantages FilenameStamper.wcm displays a menu (screen shot) when you play it. Depending on your choices, it places the filename at the bottom of Footer A or Footer B, or at the top of Header A or Header B, starting on page 1. Footer A is used by default. If it exists the macro will edit it; if it does not, the macro will create it. Thus you can use FileStamper in the same footer or header as other material. (See Operation below about issues with other headers or footers further in the document.) Also, while WordPerfect ships with a macro (FileStmp.wcm) that puts the filename in a footer or header, it does not automatically remove old filename stamps the way this macro does. (See Footnote 1) Operation Other options are available on the pop up menu:Note and tips This macro (unlike the FILSTAMP macro below) inserts a [Filename] code in the document (visible in Reveal Codes).
You can convert that code into a string of text characters so that the filename (and path, if used) becomes more permanent -- i.e., it won't dynamically change if you rename the document, as would be true using the [Filename] code to display the current file's name (and path if used). You can do this in at least two ways. Method A If you just want to convert it to text manually when editing any document: 1. In the Reveal Codes window, select just the [Filename] code (Shift+arrowkey is the easy way), then
2. immediately paste the selected code back in the same place as Unformatted text (there's a choice for that on the context menu if you right-click with your mouse -- or you can use Edit> Paste Special> Unformatted Text). Method B You can also use a macro to - 1. search for each [Filename] code, and when found,
2. select it, 3. copy it to the clipboard with EditCopy, and then use 4. EditPaste ("Unformatted Text";1; OLE!) to replace that code with the filename as plain text. For example, this small macro converts all [Filename] codes to plain text: // Macro code begins here pExitSubstructures () PosDocVeryTop OnNotFound(EndNow@) MatchSelection While(True) SearchString(NToC(64395)) // NToC(64395) = [Filename] code SearchNext(Extended!) // <= Include Headers, Footers, notes, etc. EditCopy EditPaste ("Unformatted Text";1; OLE!) Endwhile Label(EndNow@) Return Procedure pExitSubstructures () // Exit from any header, footer, footnote, endnote, // text box, graphic caption, etc.: While (?Substructure) vSubDoc:=?CurrentSubDoc SubstructureExit If ((vSubDoc=10) or (vSubDoc=11)) BoxEnd (Save!) EndIf EndWhile vBoxType:=?BoxContentType If (vBoxType=1 or vBoxType=3) BoxEnd (Save!) Endif EndProc // Macro code ends here ¤ To copy this code into your WordPerfect program to create a working macro see here. ¤ For macros that can replace [Date] codes with plain text see DATEREPL in the Library. Filstamp.wcm This macro stamps your documents with identification on just the last page (only) of the document. Operation: 1. FILSTAMP goes to the bottom of the current document and inserts two hard returns, then types the complete filename (drive and pathname), plus your initials or other indentifier such as "DRAFT COPY" (see the redlined User Modification Area in the macro's code to change the default identifier, etc.).If you make changes to the document, run FILSTAMP again to update the stamp. The default file stamp -- printed in 7-point Arial -- looks something like this: TipsC:\My Documents\Sample.wpd [DRAFT COPY] ☼ You can assign a macro to a menu, toolbar, or keystroke combination. ☼ You can use a file macro (i.e., one on your disk) as a template macro (i.e., embedded inside the template itself), and have it play whenever you print the document. To do this, copy the file macro into the appropriate template and associate it with the PRE PRINT trigger, like this: • Edit the template on which the
current document is based. (See WP's online Help <F1 key> for
more information.) When the template is open for editing, click the
Copy/Remove Objects button on the Template Property Bar.
• In the Copy/Remove Template Objects dialog that pops up, select "Macros on Disk" from the Object Type drop list, then choose the name of the macro in the Source drop list. • Click the Copy>> button, then click Close to close the dialog window. The macro should now be embedded inside the template as a template macro (as distinguished from a file macro -- i.e., one that is simply stored on your disk). • Back in the template editing window, click the Associate button on the Template Property Bar. Click the Triggers radio button, then select Pre Print in the left window. In the Macros drop list, choose the name of the template macro and click OK. (You can always remove the associate with Pre Print by selecting No Association.) • Save the template with File, Save. Test the operation of the macro by loading a new document based on the template, typing some text into it, and then printing it with File, Print. If you need to edit the template macro later, while editing the template click on Tools, Template Macro, Edit. Note also that the template on which all new
documents are based (the "default" template) is named "Create a blank
document," and is usually found in the Custom WP Templates section of
your File, New from Projects list. On disk, the default template's
filename is something like WP19US.WPT, where 19=WordPerfect X9, and US=the
US language versions. For the actual location on your system, in
WordPerfect click on Tools, Settings, Files, Template tab, and look at
the data in the Default fields.
|
|
Footnote 1 The FILESTMP macro that ships with WordPerfect is designed to place the filename in a header or footer -- both of which are "repeating elements." That is, they show up on every page until replaced or discontinued. Unless the cursor is positioned on the last page and no header or footer exists of the type (A or B) you choose, when you play the FILESTMP macro any existing header or footer will be modified (it's due to the way the macro is coded). While it is possible to modify the FILESTMP macro's code to make the filename show up on the last page regardless of any existing header or footer -- as mentioned, new headers/footers "discontinue" previous ones of the same type -- it might be easier for you to use one of the macros above. In particular, Filstamp.wcm makes the filename-stamping process more reliable, since it does not impact existing headers or footers -- which would be especially important if the user modified the document extensively, and then played the macro again. Footnote 2 Note that a macro is a WordPerfect file with a ".wcm" filename extension, and can be opened, viewed, and edited like an ordinary document. Most of the macros on this site have information or instructions at the top of the main macro code. Most have a redlined section in the macro's code that users can modify, something called the "User Modification Area." Follow the instructions there to modify various macro defaults, such as initial menu choices or initial values for the macro to use when it processes the document. |