PerfectScript Ramblings ... by JDan
1-The Birth and History of PerfectScript
WP and SSI
A long time ago, in a galaxy far, far away...
Oops, wrong story. This is the story of the birth, ancestry and descendants of the PerfectScript macro language in WordPerfect for Windows.
A long time ago (1979), in a city far, far away called Orem, Utah, in the United States of America, a legend was created, which we now call WordPerfect.
During a summer two years earlier, Alan Ashton, a professor of Computer Science at Brigham Young University in Provo, Utah, had started a 50-page design for a word processing program, which he called WP, that would be revolutionary for the time. It would be interactive, rather than requiring post-processing.
A year later, a local engineering firm called Eyring Research, had a contract with the city of Orem, to provide them with a word processing program to run on the city's Data General computer. An employee of Eyring and a student and friend of Alan's, Bruce Bastian, proposed that Eyring use Alan's design for this contact for Orem, while allowing Alan to retain the ownership rights to the design and code. Eyring agreed.
After working days, nights, and Saturdays with Alan, the project was completed in the spring of 1979. Later that year, the City of Orem allowed Alan and Bruce, on their own time, to use its Data General computer to add new features to the program, in exchange for free updates to the program.
That September, Satellite Software International (SSI) was created to make WP available commercially, and in March 1980, SSI*WP was completed and sold for $5500 (compared to the $15000 for dedicated word processing systems) to corporate customers using Data General computers. By this time, SSI had hired Pete Peterson to be an office manager.
In the spring of 1978, while Alan and Bruce spent their nights working unpaid on WP, I attended one of Alan's computer courses at BYU, which changed my life forever. As a result of this class, I changed my major from Chemistry to Computer Science, and began my career in software development two years later (but not with Alan).
WordPerfect and WordPerfect Corp
Meanwhile, SSI went on to produce version 2.20 of WP for the IBM personal computer in late 1982, which they called WordPerfect (for the lack of a better available name). For more than the next 10 years, WordPerfect would sell for $495.
In 1984, the company changed its name to SSI Software, and by that time had released versions 3.0 and 4.0 of WordPerfect. In 1986, the company changed its name again, this time to WordPerfect Corp, and had released versions 4.1 and 4.2.
Macros and Windows
Versions 5.0 and 5.1 were released in 1988 and 1989, and somewhere around this time, macros were added to WordPerfect. But I don't know if this was in version 4.2, or not until version 5.0. Maybe someone can let me know.
During this time, Microsoft had been working on improving their graphical user interface (GUI) system for DOS, which they were calling Windows, and IBM had been working on their GUI, called OS/2 Presentation Manager.
WordPerfect Corp, like many other companies, was concentrating its efforts on developing a GUI version of WordPerfect for OS/2, rather than Windows. When Microsoft released Windows version 3.0 in May of 1990, its popularity caught a lot of companies unaware, and there was a lot of scrambling to release Windows versions of their programs. It wasn't until November of 1991 that WordPerfect for Windows version 5.1 was released. While designed for a GUI system, WPWin 5.1 was designed to have at least the same capabilities as the DOS 5.1 version released two years earlier. Release of a DOS 5.2 version was postponed so that WPWin 5.1 could be completed and released.
In early 1991, I started work at WordPerfect Corp to help with the release of WPWin, but was not initially assigned to the macro group, and worked on the File Manager that was bundled with WPWin.
WPDOS and WPWin Macros
Even though the initial release of WPWin had to have at least the same capabilities as the DOS version, it would obviously be different in many ways. The user interface would use the graphical screen mode of Windows to truly give the user WYSIWYG capabilities (What You See Is What You Get).
The macro language (simply called "the macro language") was also different. The DOS macro language was based on the keystrokes used by a user to perform an operation. The problem with this approach, is that the keystrokes to perform an operation are different in the English version of the program, and the international versions. So a macro recorded in English, won't work or won't produce the same results when played in, say, the Spanish version.
An additional requirement for the WordPerfect for Windows products was that there would be a common macro language for all the products which would be produced, and since by design, multiple programs could run at once in Windows, then a macro should be able to control all the running programs at once.
Neither of these issues could be easily solved with the current WPDOS 5.1 macro language, and so these requirements led to the creation of an independent development team (separate from the WordPerfect development team), and the design of a substantially new macro language for WPWin. This macro language was loosely based on the macro language work which had been developed and used in the MacIntosh version of WordPerfect, and would appear quite similar to a conventional programming language like BASIC or C, where the commands for WordPerfect would appear as subroutine calls with data passed as parameters. The macro language would also be controlled by a program separate from WPWin (the Macro Facility), and would not require a special program to edit or create a macro, but macros would be stored as WordPerfect documents, and WPWin itself would be used to edit a macro.
This gave birth to what would eventually be called "PerfectScript" in the years to come.
WordPerfect for Windows version 5.1 was finally released with this new macro language in November of 1991, and the release of WordPerfect for Windows would cause the largest jump and highest month ever in sales in the history of WordPerfect Corp.
Macros and DDE
Part of the design of Windows, was that programs could communicate with each other, and one program could control another, through a technology called Dynamic Data Exchange (DDE). Using DDE, WordPerfect could "register" a service with Windows, where any program could send commands to WordPerfect. These commands are the same commands available from a macro, and so any program capable of sending commands through DDE could control WordPerfect similar to how the macro language could control WordPerfect.
On the opposite end, using DDE, the WordPerfect macro language was given the ability to control any other DDE aware program, such as Microsoft Word.
Early the next year, WordPerfect and the macro language was enhanced, and WPWin 5.2 was completed and released in 1992, the year that Pete Peterson left WordPerfect Corp. By then, efforts were already underway to produce version 6.0 for DOS and Windows, with the DOS project several months ahead of the Windows project.
The WPWin macro language proved to be such a successful design and concept, that the same macro language design was adopted and included into the version 6.0 DOS product as well. Due to the differences in the underlying operating systems (DOS vs. Windows), and because of the time lead in the DOS project, two separate development teams were set up, which resulted in similar, but not identical macro languages.
It is important to understand that the macro language really consists of two parts. The core macro programming language defines the overall format and syntax of a macro. This defines the rules which govern the form in which a macro is written, how a "command" is specified in a macro file, how data parameters to the commands are separated, what variable names look like, etc.
This core macro language also contains a set of commands itself, which do not involve a product like WordPerfect, but are used to control how a macro flows and the order of macro commands. These commands are called "programming" commands.
The other part of the macro language, by far the largest part of the macro language, consists of the "product" commands. These commands are not actually part of the macro system itself, but belong to the "products", like WordPerfect.
The macro language allows itself to be extended dynamically by a product such as WordPerfect, to include commands that have meaning to that product. The core macro system acts as a traffic coordinator to pass these commands to the products, where the operations for those commands are performed, and the results are returned to the core macro system to be used in subsequent commands and statements.
For WPWin 6.0, it was decided that there was no need for a File Manager, and its follow-on project was canceled, so I was reassigned to the macro team for WPWin 6.0 (which now only had a single person). My first assignment was to review the DOS and Windows 6.0 macro languages, and to recommend changes that would make them more compatible. This was limited to the core macro language, the programming commands. For the most part, these were very close, and after a few changes in both the DOS and Windows macro systems, the core macro languages were about 95% compatible with each other, with provisions for a macro to identify and include macro code and commands specific to the DOS or Windows versions.
Concurrent with the DOS and Windows development efforts, development of a Unix version of WordPerfect 6 was also begun, based on the same code as the Windows version. The Unix version would then actually be closer in capability and function to the Windows version than the DOS version would be.
In 1993, version 6.0 of both DOS and Windows were released, about six months apart, with DOS released first (version 6 of WordPerfect for Unix was also released this year as well). In April of 1994, Novell attempted to compete directly with Microsoft in the applications arena, and bought out WordPerfect Corporation and its entire product line, and released WPWin 6.1 in the end of 1994, and WPDOS 6.1 in 1995.
The PerfectScript Name
Meanwhile, Microsoft was developing their 32-bit version of Windows, which was released as Windows 95, and the development teams at WordPerfect began the porting of WPWin to this new 32- bit environment for version 7. It was during this time, that more people were added to the core macro language development team, including one from the Unix macro team.
But before this effort was completed, Novell concluded that it needed to refocus on what it had been successful with in the past - networking software - and sought a buyer for its Applications group. A long time and large distributer of WordPerfect software, Corel Corp, took Novell up on this offer, and purchased the WordPerfect product line from Novell in 1996, and kept the Orem development teams intact.
In order to increase product identity for the announcement of the 32-bit version of WordPerfect for Windows 95, marketing coined the term and announced the creation of PerfectScript as the common macro language for version 7. This caught us in the macro development team by surprise, as we wondered whether we should be working on some new product called PerfectScript. Our "fears" were calmed, when it was explained that this was the name that was being given to what we had already been working on for some years now, the WordPerfect macro language.
Version 7 was released in early 1996, followed by a re-branded Corel version of WPWin 6.1. However, not everyone in the world jumped onto the 32-bit Windows 95 bandwagon, and so Corel back ported some of the new features that were added in WordPerfect 7 for Windows 95, to a new release of version 7 for 16-bit Windows 3.1, containing the version 6.1 macro language.
After the release of version 7 in 1996, work on WPWin version 8 was begun. This work was completed and version 8 was released in the fall of 1997. Shortly before this release, a Linux version of WordPerfect 8 was also begun and eventually released, being based (to my knowledge) on the Unix code base (from version 6).
PerfectScript and OLE Automation
As the Windows 95 platforms matured, Microsoft introduced a technology similar in concept to DDE, that, like the earlier DDE technology, would allow a program to expose a set of commands to the outside world, and allow one program to programmatically control another program. In essence, a program could be viewed as a library or set of commands to perform some set of operations, and another program could call upon those commands to perform those operations. Originally called OLE automation, today this technology is usually called ActiveX automation.
There are an enormous number of similarities between OLE automation, and the techniques used by the original WPWin macro language.
To use OLE automation, the controlling program would usually be a programming language, such as Visual BASIC (VB), or Delphi or C (or PerfectScript). This programming language would have a core set of built in "programming" commands, but could be extended by, and call upon independent sets of commands provided by a separate application or product.
New in PerfectScript for version 8, was the ability to be an OLE automation controller program. Now, PerfectScript could send commands to the other WordPerfect products using its native command passing technology, or it could send commands through DDE to any DDE aware application, or it could send commands using the OLE automation technology to the growing number of OLE automation capable products.
PerfectScript and VBA
Late 1997 marked the start of development on WPWin version 9. However, a few months before the scheduled fall 1998 release of version 9, Corel found it necessary to close the Utah development office, and except for a small handful of core developers from all the product teams, all remaining development was transferred to its Ottawa headquarters. This delayed the release date of version 9 until April of 1999.
New in WordPerfect version 9, was the addition of VBA (Visual BASIC for Applications) as an alternate macro language. After the release of version 8, Corel's PerfectScript development team and the third party developer support group devised an add-on code module that would accept commands from an OLE automation controller program, such as Visual Basic or Delphi, and would translate these commands into the equivalent PerfectScript macro commands, and send these commands through the PerfectScript macro system to WordPerfect.
In version 9, this separate OLE automation interface was added directly into WordPerfect version 9, which allows access to the WordPerfect product commands from any OLE automation controller. VBA is one such OLE automation controller, and the VBA macro language was added to version 9.
In addition, another separate OLE automation interface was also added to PerfectScript, which provides access to the majority of the core "programming" commands in the PerfectScript macro language as well. But in most cases, this OLE automation interface is not required, since VBA provides its own programming command set that can be used in place of most of the PerfectScript core programming commands.
After the release of version 9, work on several service packs was performed to make changes needed by the continuing release by Microsoft of new versions of Windows, including Windows 2000, Windows ME and the Windows Terminal Server 2000.
PerfectScript and Linux
You may recall the public fervor over Linux during late 1999 and early 2000. Part of this was due to the release by Corel of WordPerfect version 9 in March 2000 that would run on Linux, which provides the "full" capabilities of the Windows version of WordPerfect (except for OLE automation and VBA). This Linux release utilizes the full source code from WPWin version 9, including the full PerfectScript macro language.
The Future of PerfectScript
We now stand at the beginning of WordPerfect version 10. Over the 10 years since the "birth" of the macro language that we now call PerfectScript, the macro language has changed and evolved quite a bit, but continues to be more than 90% compatible with macros written 10 years ago. The backward compatibility of just the PerfectScript core macro programming language is close to 99% for any pervious version of the macro language for Windows.
So what of the future of PerfectScript? Corel has publicly expressed their support for PerfectScript into the future. Of all viable macro languages that could be used by WordPerfect, PerfectScript is the macro language of choice for the WordPerfect product line. It is fully integrated into all the WordPerfect family of products, and provides capabilities not available in alternate choices. I believe we can safely see PerfectScript's continued existence and support for a long time to come.
In following articles, we will discuss in more detail, various aspects of the core PerfectScript macro programming language, addressing the "programming" commands rather than the "product" commands of any particular product like WordPerfect. These concepts can be equally applied to macros written for any of the applications which support PerfectScript macros: WordPerfect, Presentations and QuattroPro.
We will discuss how to convert macros from older versions of the macro language (both the DOS and Windows versions). We will also discuss the specific changes to the core macro language over the years, identifying commands which have become obsolete, and their supported replacements. Other topics will include in-depth discussions of the use of user defined dialogs within a macro, the array data type, calling the Windows API routines using DLLCall, OLE automation, etc.
JDan is the online identity of J Dan Broadhead. J Dan Broadhead is a software developer, who has worked on the development of the PerfectScript macro language for over 10 years, for versions 6 to 10, for WordPerfect, Novell, and Corel. He can be contacted at firstname.lastname@example.org.