Custom programs or scripts are invoked automatically during the conversion process. WordToWeb provides access to the conversion process at two points:
Pre-conversion macros must be written in Visual Basic for Applications (Word 97 or later) or WordBasic (Word 95). These macros are run before WordToWeb converts the document to HTML. The macro is run on a copy of each source document (the source document itself will not be modified). The macro should be saved in the Normal template.
In designing a pre-conversion macro, follow these rules:
Post-conversion programs/scripts are run on each HTML file created by WordToWeb. The program or script will be called once for every HTML page created.
The path to the HTML files is passed as a command line argument when your program is called:
yourprogram <full path to HTML page>
To create a post-conversion program or script you can use any Windows programming or scripting language (C/C++, Visual Basic, etc.). Post-conversion scripts are simple command line programs; they do not require a visual interface. If you use an interpreted scripting language like Perl, then the associated executable must also be installed on your computer.
Using Perl
An example post-conversion script is included which uses Perl (Practical Extraction and Reporting Language). Perl is an excellent choice for manipulating HTML because it has very strong text processing capabilities. Also, many webmasters and programmers are familiar with using Perl in conjunction with HTML because it is a common choice for CGI programs.
To use Perl with WordToWeb, you must have the Perl executable properly installed on your computer, and you must have defined an association between the extension you use for your script (usually .pl) and perl.exe.
Perl for 32-bit Windows is a free download. You can obtain the latest version of ActivePerl (tm) from ActiveState Tool Corporation's website, http://www.activestate.com.
Solutionsoft also markets Perl Builder, a complete integrated development environment for developing Perl scripts. You can find out more about Perl Builder at http://www.solutionsoft.com/perl.htm.
The Perl Post-Conversion Script Example
WordToWeb includes a simple Perl script which demonstrates how post-conversion scripts work. The included example simply locates all hyperlinks and places <B> </B> tags around them so that all links are bold.
If you are interested in using Perl with WordToWeb, please examine this script and the comments it contains. You can modify this example script to meet your needs.
To Try the Example
Conversion scripts are specified in the WordToWeb project file, so you can specify them directly without using the Wizard dialog boxes if you wish.
The settings are in Windows INI file format and can be set using the WritePrivateProfileString API function.
[Extensions]
run_pre=0|1
run_post=0|1
pre_name=<name of pre-conversion script>
post_name=<full path to post-conversion script>