Some Examples of Windows and Apple Scripting


About this page | Applescript applications | VisualBasic applications | AutoIt 3 applications


 

About this page

This page contains links to some examples of Applescripts, Visual Basic scripts written for the Windows Scripting Host, and an AutoIt3 script. I offer them as sources of techniques that other Apple and Windows scriptwriters may find useful; some of these techniques are based on information that is otherwise undocumented.

I don't pretend that these are well-written scripts, and some of them are disfigured by spaghetti coding. But they include routines that someone might find useful.

For modifications that I have made to C++ code, see the Windows and OS X build environments that I have put together for my DOSBox for Text-Based Applications project.

 


Applescript applications


 

An Applescript that launches a self-contained SheepShaver-WPMac application in OS X

This script is the heart of a complex self-contained system that uses the open-source SheepShaver PowerPC emulator to run the "classic" OS X in a window on the OS X destkop. WordPerfect 3.5e for the Macintosh runs under the emulator, and the emulator automatically opens when WordPerfect files are double-clicked in OS X. The script is incorporated in an Applescript application which also contains supporting files, utility software, the SheepShaver application, and a disk image containing the System 7.5.5 system together with WordPerfect and other programs.

The full system is described (and may be downloaded from) a separate page on the WordPerfect for DOS Updated site. The script itself does nothing without the rest of the system, but is provided here for any interest that its techniques might have.

Use this link to display the script in HTML format. The script may be copied and pasted into the Applescript Editor.

 


 

An Applescript that manages disk images for Basilisk II or SheepShaver under OS X

This script is not for use with the SheepShaver application described immediately above. It is designed for use with Basilisk II or with versions of SheepShaver that store their preferences in a hidden file in the user's home folder. It displays a series of menus that make it possible to add, remove, and otherwise manage disk images in Basilisk II under OS X. By changing a variable in the script, the script will manage disk images in SheepShaver, but only if SheepShaver's preferences are stored in a hidden file in the user's home folder.

Use this link to display the script in HTML format. The script may be copied from the browser window and pasted into the Applescript Editor.

 


VisualBasic scripts


 

A Windows VBS script that uses Microsoft Word to convert WordPerfect documents into Microsoft Word or PDF format

This VisualBasic script (displayed here in HTML format) converts one or more WordPerfect documents into Microsoft Word or PDF format, using an installed copy of Word. The original documents are unchanged; the Word or PDF versions are created in the same folders with the originals. The script can be run from the command line with a complex series of command-line switches, or a file or folder can be dropped on the script itself. The script includes an undocumented method for determining the source format of files opened in Word; this method was reported to me by a source at Microsoft but has not otherwise been reported publicly. Because it is undocumented and unsupported, it may be changed in future versions of Word.

For further details see a separate page on the WordPerfect for DOS Updated site, which also contains information about the script described immediately below.

 


 

A Windows VBS script that uses LibreOffice to convert WordPerfect documents into Microsoft Word or PDF format

This VisualBasic script (displayed here in HTML format) converts a WordPefect document into Microsoft Word or PDF format, using an installed copy of OpenOffice.org. The original document is unchanged; the Word or PDF version is created in the same folder with the original. This script is less ambitious than the one described immediately above, but illustrates some techniques for scripting OpenOffice.org under Windows.

For further details see a separate page on the WordPerfect for DOS Updated site, which also contains information about the script described immediately above.

 


 

A Visual Basic for Applications macro that converts WordPerfect symbols in Word documents

When Microsoft Word imports WordPerfect documents on a system on which WordPerfect for Windows is installed, Word converts non-ASCII characters into special codes that use WordPerfect's special fonts to display characters. As a result, characters such as the quotation mark cannot be searched or replaced in Word. This VBS macro for Word 2007 and 2010 (displayed here in HTML format) corrects the problem, using undocumented techniques in Word. A faster version for Word 2003 and earlier is also provided (and displayed here in HTML format).

For a description of this macro, and how to use it, see a separate page on the WordPerfect for DOS Updated site.

 


AutoIt 3 applications


 

An AutoIt3 script that installs a universal printing system for WordPerfect for DOS running under Windows

This script file, written for the AutoIt3 scripting system, when compiled into an executable file (together with fourteen files required by the system), creates an installer program that sets up a printing system for use with WordPerfect for DOS and any Windows printer. The script downloads and installs Ghostscript for Windows; it installs a directory-monitor system written by a programmer who calls himself "Chicks"; and it installs WordPerfect printer drivers for use with Ghostscript. The entire procedure is extremely complex, and involves the creation on-the-fly of WordPerfect macros and Windows command files, and complex manipulation of Windows user rights.

This script demonstrates techniques for manipulating rights under Windows, together with other routines that may be useful to AutoIt script writers.

For a full description of what this script perfoms, and a copy of the compiled executable file, see a separate page on the WordPerfect for DOS Updated site.

 


 

Home page | Top of this page