New in the Macro system of WordPerfect 6



This document describes new and improved features in PerfectScript. It includes new features and changes since PerfectOffice 3.0. This version of this document also includes the undocumented features and commands.



Document Change Log

6/23/98 JDan 1.1 - Add a missing command (><).

9/8/97 JDan 1.0 - Document created to document changes implemented in PerfectOffice 3.0 / WordPerfect 6.





Quick Overview of WordPerfect 5.x Macro Compatibility



This section provides a quick overview of things you may need to do to your WordPerfect 5.x macros to make them work in the WordPerfect 6 macro system. The next section, Modified and Improved Commands and Language Features, provides more extensive details.



The Macro Facility (the program--MFWIN20.EXE)





The Macro Facility Interface Changes





Advanced / Hidden Features, Settings and Keystrokes in the macro system



The WordPerfect Macro system has a number of hidden features and settings that are not documented, and not supported. These are used primarily for internal debugging and testing, and may contain bugs. Direct access to these features and settings from the user interface of the MacroFacility (MFWIN20) is not available. Access to these settings is only available by running the BIF editor (BIFED20.exe) and manually adding or modifying these settings.



Hidden keystrokes in the MacroFacility user interface

Control Shift Alt Object Action

Control Shift Insert key Command Inserter 1

Control Shift Alt Insert key Command Inserter 2



Hidden BIF settings

...





Command Inserter



The command inserter has been completely re-written. All commands, whether builtin programming commands or product commands, are displayed using the same format. The command inserter can also be displayed from the Macro Facility user interface by ...





Dialog Editor and Dialog Statements



A Dialog Editor has been added to allow dialogs for macros to be created usiing an interactive graphical tool. ...





Macro Debugger



A simple macro debugger has been added. The debugger can be accessed by placing a Step (On!) command in the macro where the debugger should be displayed.





Obsolete Commands and Language Features



In a future release of the macro system, there are some commands that may or may not be supported. Users are encouraged to replace these commands with their functional equivalents (if any) as soon as possible. For backward macro compatibility, these commands will continue to be supported, but they will no longer be documented in the command browser or in the macro help information. These commands may be eliminated in some future release.

Enumerations for built-in commands

AssertCancel

AssertError

AssertNotFound

CancelOn

CancelOff

ErrorOn

ErrorOff

DialogDisplay

DialogUndisplay

DialogSendMessage

NotFoundOn

NotFoundOff

ReturnCancel

ReturnError

ReturnNotFound



Enumerations for built-in commands

The keyword parameter values for built-in commands of the macro system have been changed to enumerations, and have had a trailing "!" symbol added to the names. This is to bring the syntax of the built-in commands into conformity with the product commands. This affects the following keywords:

Application - Default - Use Default!

Cancel - On, Off - Use On! and Off!

Error - On, Off - Use On! and Off!

NotFound - On, Off - Use On! and Off!

DLLCall, DLLCall Prototype - Bool, DWord, Integer, Real, String, Word, AnsiString, OemString, WPString, Void - Use Bool!, DWord!, Integer!, Real!, String!, Word!, AnsiString!, OemString!, WPString!, Void!

Menu, MenuList - Digit, Letter - Use Digit! and Letter!

VarErrChk - On, Off - Use On! and Off!

DefaultUnits - Centimeters, Inches, Millimeters, Points, WPUnits, WP12000ths - Use Centimeters!, Inches!, Millimeters!, Points!, WPUnits!, WP12000ths!



AssertCancel, AssertError, AssertNotFound

The functionality of these commands is available through the Assert command, specifying the desired condition to assert in the Condition parameter as CancelCondition!, ErrorCondition! or NotFoundCondition!.



CancelOn, CancelOff

The functionality of these commands is available through the Cancel command, specifying On! or Off! as the state parameter.



ErrorOn, ErrorOff

The functionality of these commands is available through the Error command, specifying On! or Off! as the state parameter.



NotFoundOn, NotFoundOff

The functionality of these commands is available through the NotFound command, specifying On! or Off! as the state parameter.



DialogDisplay

Use the DialogShow command.



DialogUndisplay

Use the DialogDismiss command.



DialogSendMessage

This command was never fully implemented, and has been removed from the documented command list.



ReturnCancel, ReturnError, ReturnNotFound

Use the Return command, specifying the desired condition to assert in the Condition parmeter as CancelCondition!, ErrorCondition! or NotFoundCondition!.



VarErrChkOn, VarErrChkOff

The functionality of these commands is available through the VarErrChk command, specifying On! or Off! as the state parameter.





Modified and Improved Commands and Language Features



This section describes changes to existing commands and, where applicable, incompatibilities that may arise with old (WordPerfect 5.2 and prior) macros. In this section, "..." indicates places where existing capabilities have not been changed.

various commands



various commands

In the 5.1/5.2 version of the macro language, no commands could be called as functions to return values. All commands, including built-in programming commands and product commands, had to be called as procedures. Any output values were returned in variables that were passed to these 'procedures' as parameters (usually the first parameter). In this release, the concept of functions was introduced, and many of the 'value returning procedure' commands were changed to allow them to be called as functions that would return values. For the most part, this change was made to the built-in programming commands and a few product commands of the macro system itself. Though the capability was available to our product applications, WPWin did not use this feature, and all the programming commands that were part of the Macro Facility also did not implement this. For compatibility with the 5.1/5.2 release, all programming commands that were changed from procedures to functions, continued to accept the procedure call format even though we only documented the function format. In this new release, the remainder of the 'value returninig procedure' programming commands that were still called and documented as procedures have been changed to functions, while still retaining their procedure calling format for compatibility with previous releases.



The commands that were changed are:

AppLocate, DDERequest, Fraction, Integer, NumStr, StrLen, StrNum, StrPos, SubStr



This dual procedure/function calling format can cause a potential confusion on the user's part. If one of these 'dual' calling format commands is called as a function, then the result is returned from the command (not as a parameter). If it is called as a procedure, then a new first parameter must be specified, which is the name of a variable to receive the result value. For example:

a := StrLen ("this is a string") // function format - 'a' gets result

StrLen (a; "this is a string") // procedure format - 'a' gets result



The confusion arises when these 'dual' format commands are compared to functions that do not support this 'dual' format. A'normal' function, may also be called as a procedure, but when it is, it does not accept a new first parameter to receive the result value. The result is lost if called in a procedure format. For example:

a := NToC (65) // function format - 'a' gets result

NToC (65) // procedure format - result is lost



If an attempt is made to call a 'dual' format command in a procedure format without the new first parameter, then a compile error will usually result. For example:

StrLen ("this is a string") // procedure format - will generate compile error



This procedure call to StrLen doesn't appear to be different than the procedure call to NToC, and since both are documented as functions taking a single parameter, then a user could become confused as to why one generates a compile error and the other doesn't. However, a procedure call to NToC or StrLen without keeping the result is senseless, since the result of performing the command has been lost, and so the command has performed no useful purpose. Because of this, we feel that this situation will rarely occur, and is worth the compatibility that is gained.



Application

Application statement (and EndApp and NewDefault statements) no longer limits product prefixes to two characters and will now usually be the name of the product itself. This improves readability of macros when more than one product is involved in the macro.



Assert (Condition:enumeration or numeric)

Assert now accepts a condition code of CancelCondition!, ErrorCondition! or NotFoundCondition!.



Break ([<StatementName>label>])

This command accepts the name of the statement to break out of.

[StatementName] This is the name of the statement that this Break statement goes with. This parameter is completely optional, and if specified, does not have to match the actual statement that is goes with, but is allowed in order to allow the macro to be more self documenting.



EndFunc ([<Name>label])

EndProc ([<Name>label])

These commands accept optional parameter.

[Name] This is the name of the Function or Procedure that this EndFunc or EndProc command goes with. This parameter is completely optional, and if specified, does not have to match the Name used in the Function or Procedure command, and is allowed in order to allow the macro to be more self documenting.



EndFunction ([<Name>label])

EndProcedure ([<Name>label])

These commands are synonyms of the EndFunc and EndProc commands.



Next ([<StatementName>label>])

This command accepts the name of the statement to continue to the next iteration of.

[StatementName] This is the name of the statement that this Next statement goes with. This parameter is completely optional, and if specified, does not have to match the actual statement that is goes with, but is allowed in order to allow the macro to be more self documenting.





New Commands and Language features



This section describes new commands and language features which have been added.

new reserved words



new reserved keywords

New keywords have been added to the macro language. These keywords are reserved words and may not be used as variable or label names in macros. In addition to these new reserved keywords, the name of any new commands are also considered reserved words, since those names also cannot be used as variable or label names. (However, just because a new reserved keyword is on this list, does not imply that there is a new command or feature by that name that can be accessed.) The new reserved keywords that have been added are:

Several new commands have been added, which are now reserved words, but they do not need to be listed separately. See below for the list of new commands.

...



>< (inequality)



Break [Switch]

Break [For]

Break [ForNext]

Break [ForEach]

Break [Repeat]

Break [While]



Next [For]

Next [ForNext]

Next [ForEach]

Next [Repeat]

Next [While]



EnvVariableGet

EnvVariableSet

Value





Bugs Fixes and Corrections