| Barry MacDonnell's
Toolbox for WordPerfect
Macros, tips, and
templates for Corel® WordPerfect® for Windows®
| Page updated Nov 18, 2020
|UPDATER - Update a document with the current system's defaults, and also remove confidential information from the Undo/Redo History feature as well as all spell-checker skipped words from the Document Word List|
For a similar macro, download (Corel C_Tech) Charles Rosssiter's NewSave macro here.
For a similar macro for WordPerfect 6.1, see #UPDATE.WCM in the WP6.1 version of John Land's collections on the Other Authors page.
Updater.wcm - A macro to "update" the current on-screen document, or any selected file on disk, with the current system's default template settings. [Note: To do this for multiple files on disk, in batch mode, see Footnote 1.]
This is helpful if you want to
• annotate a document from another source and use your own default template's settings (default font, redline method, etc.); or
• update old files with new default fonts, etc.; or
• remove annoying pop-up messages about permission to hyphenate in documents where hyphenation was previously turned on, but where it is currently turned off; or
• remove information that may have been stored in Edit, Undo/Redo History when the document was saved. (This feature -- to save revision history or "metadata" -- is a user-selectable setting. Click the Options button from the Undo/Redo History dialog and uncheck "Save Undo/Redo items with document." Then resave the current document and play Updater on it just to be sure.) Such metadata information can be recovered and viewed by others who share your documents, so unless you always create documents with the "Save Undo/Redo items with document" turned off, you may want to use Updater to remove your confidential revisions, deletions, etc., before distributing them. If nothing else, the documents should be smaller in file size after playing Updater on them; or
• remove the contents of the Document Word List, which stores spell checker words that have been skipped during a spell check; or
• try to fix damaged or corrupted documents with the "X-Insert" or "X-Retrieve" method (see here for more information on the causes and cures of damaged or corrupted documents).
The macro uses a simple trick to accomplish its task:
 First, it stores the "guest" document's path and filename, and then immediately closes the document.
 Then it opens a new document (the "host") and enters a single character (a technique called "X-Insert" or "X-Retrieve").
 Then it erases that character. This establishes the hidden file header ("prefix") using your template defaults.
 Then (using the stored filename) it inserts the guest document (with File|Insert) which then will take on the settings (e.g., redline method) of the host document.
 Finally, it saves the host file using the filename of the guest file, overwriting the guest file on disk.
Simply play the macro. You are given the choice of updating the current document on screen or any file on disk. If the file on screen has been modified, you will be asked if you want to save the changes (you must save the changes if you want the macro to continue).
Need to update several (or many) files in one operation?
The "X-Retrieve" method described above can be used in batch mode by using two macros:
(1) A batch file processor such as DoFolder.wcm by Corel C_Tech Roy Lewis (main site: https://www.lemoto.org.uk/corel/mcMenFl.htm). (2) A simple variation of Updater.wcm, as below.
1. Copy (not move) all the files to be processed into a separate, empty folder. Do not open any of them, just leave them on disk.
2. Download Roy "lemoto" Lewis's DoFolder macro above.
3. Place both the DoFolder macro and the macro below in your default macro folder as shown in Tools, Settings, Files, Merge/Macro. (Tip: To copy the macro below into your WordPerfect and create a functioning macro, see https://wptoolbox.com/tips/CopyCode.html.)
4. Play DoFolder.wcm, the first macro, which will display a menu to let you choose the folder containing the files to process; then it lets you choose the name of the macro below (by whatever name you give it); and then it plays that second macro on each file in the chosen folder (step 1).
Be sure no other files are open when you play these macros.
// Macro begins:
// Get the path and filename of the currently open file:
// Close the file without a prompt:
// Open a new document:
// Reset the internal header of the current document:
// Insert the previous file:
// Save the file with its new header (overwrite mode):
// Close the file:
vDoFolderDone=True // (<= used with DoFolder macro)
// Macro ends