PerfectScript Journal

November 1998: New Commands in WordPerfect 8 for Windows

WordPerfect 8 for Windows brings with it several new macro commands that help make processing data easier than ever before. This month we'll briefly skim over some of those new commands.

Date Commands

Several new date commands make it easier than ever to calculate dates. For example, the DateAddDays command allows you to add a specified number of days to a date. Similarly, the DateAddWeeks , DateAddMonths , and DateAddYears commands make date calculations a snap.

Additional new commands return the number of days in a given month (DateDaysInMonth). This is especially useful in leap years, and for those of us who can't remember that stupid rhyme (30 days has November ...). You can find out if a certain year is a leap year (DateIsLeapYear), the date of a certain day in the year (DateOfNthDay), or even what week of the year (DateWeekOfYear)).

You can even get information relating to the current time zone (TimeZoneInfo).

Error Handling

WPWin 8 reintroduces some error handling commands that were available in WPWin 5.1/5.2. They don't add any functionality that is not already available: the just add a new way to accomplish the same thing.

AssertCancel
AssertError
AssertNotFound

These commands are the same as Assert(Cancel!), Assert(Error!), and Assert(NotFound!)

CancelOff
CancelOn

These commands are the same as Cancel(off!) and Cancel(on!)

ErrorOff
ErrorOn

These commands are the same as Error(off!) and Error(on!)

NotFoundOff
NotFoundOn

These commands are the same as NotFound(off!) and NotFound(on!)

VarErrChkOff
VarErrChkOn

These commands are the same as VarErrChk(off!) and VarErrChk(on!)

ReturnCancel
ReturnError
ReturnNotFound

These commands are similar to Assert(Cancel!), Assert(Error!), and Assert(NotFound!)

File Conversion Commands

These commands are really handy when you are opeing files that may be in a non-WP format.

FileType

Returns the format of a file on disk.

FileTypeExtension

Returns the default filename extension of the specified file type

FileConvert

Converts the specified file from one format to another

FileConvertError

Returns a string representing any error encountered during a file conversion

FileTypeList

Returns a list of file types

FileTypeName

Returns the name of the specified file type.

New Open Dialog Capability

Probably the most useful new command in WPWin 8 is the FileNameDialog command. With this command you can display a File List dialog that is customized for your needs. You can specify the caption on the title bar, the text on a button, which directory and files will appear in the list, and many other options.

User-Defined Dialogs

There are several new region command that allow you to manipulate the contents of lists more easily.

RegionAddListItemByIndex
RegionGetClass
RegionGetListContents
RegionGetListItem
RegionGetListItemByIndex
RegionGetListSelectedCount
RegionGetModified
RegionIsEnabled
RegionRemoveListItemByIndex
RegionSelectListItemByIndex
RegionSetBitmap
RegionSetBitmapFilename
RegionSetEditSelection
RegionSetModified
RegionSetSelectedText

There are also commands that allow you to more easily get the contents of a dialog control, and to set the dialog variables before the dialog is dismissed.

DialogControlQuery
DialogControlUpdate

Getting Version and System Information

VersionInfo

This command gets specific information about the version of WordPerfect and the operating system

GetWPData

This command returns the same information that many current system variables returns.

MacroInfo

This command returns information specific to the macros. For example, you can get the exact version of PerfectScript that was used to compile the macro; whether there are breakpoints i the macro; how long it took to runt he macr, and so on.

Compatibility Issue

If you need your macros to work with both WPWin 7 and WPWin 8, you should not use these new commands in your macros, since the new commands will not be recognized in WPWin 7.

Along with the commands I've touched upon above, there are several new commands that appear in the Command Inserter in WPWin 8. Some of them seem to not be completely implemented yet. Hopefully, they will be functional in future versions of WPWin.
 

Next month: Repeating a macro multiple times

For more information on this topic, and specific usage of the new commands, get a copy of my book.

For information on ordering my book see my web page.

 

Copyright Notice: The information included in the PerfectScript Journal is protected by US Copyright. The author grants you the right to use the routines in your own macros as needed. You may not sell, distribute, or publish them in any form.
If you choose to use the information here, you do so entirely at your own risk. No representations are made regarding the fitness of this information for your   particular purpose, or for your ability or inability to use the information. You   are advised to make backups of all relevant files before implementing any suggestion  or technique.
© Copyright 1998 by J. Jeppson.