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®
© Copyright 1996-2017 by Barry MacDonnell. All Rights Reserved.

Page updated Oct 26, 2006

Updated code for the following five "obsolete" macro commands (thanks to David Wallis for this tip):

?MarginTop
?MarginBottom
?MarginLeft
?MarginRight
?CurrentPrinter

These system commands were used to get (and store) the current values for the currently selected printer and the margins at the current cursor location. Thus, you could program a macro to change printers (say, to your fax "printer") or change margins, and then restore things to the way they were prior to your changes.

For example, you could (1) store the current value of the left margin in a variable; (2) change the margin to some newly desired setting (such as 3"); and (3) reset the left margin after doing something that requires the new left margin setting.

vOldLeft:=?MarginLeft
MarginLeft(3")
// ... do other things here ...
MarginLeft(vOldLeft)

Now that these system commands are obsolete (in WP9), you can use the normal product commands without a parameter in their place. In the example above, you would use:

vOldLeft:=MarginLeft()
MarginLeft(3")
// ... do other things here ...
MarginLeft(vOldLeft)

Other commands that were changed can use these formats in place of the "<variable>:=?<command>" format:
vOldRight:=
MarginRight()
vOldTop:=
MarginTop()
vOldBottom:=
MarginBottom()

If you have a macro that needs to play in WP8 (or earlier) as well as in later versions, and needs to obtain current margin values and then reset margins to the current values at some later point, you could use IfPlatform() to accommodate the two types of commands:

IfPlatform(_version9!) // e.g., if WP9 -
vLeftMarg=MarginLeft()
vRightMarg=MarginRight()
EndifPlatform
IfPlatform(_version8!) // If WP8 -
vLeftMarg=?MarginLeft
vRightMarg=?MarginRight
EndifPlatform

// do something else here ... then reset the margins:

MarginLeft(vLeftMarg)
MarginRight(vRightMarg)

Note that separate IfPlatform segments would need to be constructed for each subsequent version of WordPerfect where the macro might be played. For parameters, use (_version10!) ... (_version11!) ... (_version13!) ... etc. See the bottom section of LABLCOPY as an example, which uses IfPlatform segments to store margin commands for WP6-WPX3.

With respect to ?CurrentPrinter, use somehting like this:

vPrinterName := PrinterSelectbyName ("Your Current Printer")
PrintCopies (NumberOfCopies: 1)
Print (FullDocument!)
PrinterSelectbyName (vPrinterName)

-- where Your Current Printer is the exact name of your current printer (or fax driver) selection, as it appears in the printer dialog (File, Print). The last command above will return the setting to your preferred default after the document is printed.

Finally, note that the normal command to set a new value can be used without a measurement as a parameter. When you do this the current value is returned instead, and can be stored in a variable as before.

See also: IMPORTANT NOTES ABOUT MACROS FOR USERS OF WORDPERFECT 9 AND WORDPERFECT 10