This is a set of Word for Windows macros to do something Word doesn't
let you do easily, and which is sorely missed by anyone developing a
Help system.  If you don't know how to install a macro into your
template, see the last section.

If you know how to work with macros (even just a little), you might just
want to install the macros in NORMAL.DOT and see they do.  You can
always read this later.  Run Collector first, then KeyCollector, then
KeyThing.

David DelGreco
------------------------------------------------

If you haven't kept track of all those footnotes you've been entering
(or if you tried, but you're not so sure about its accuracy), you're
eventually going to wish you had.

I often work as a firefighter in my company.  I've worked on two Help
systems now, each of which was comprised of 23 files (just a
coincidence).  One had 600 topics, the other had over 800.  In both
cases, someone else did the bulk of the work and became very familiar
with the file by working with it.  But, not having worked with the files
before, I needed a way to create a "map" of the files.  So I wrote these
macros.  It was a two-day job, followed by two weeks of getting around
bugs in WinWord and WordBasic.  But that's another story...

The end result is a comma-delimited file which can be imported into any
spreadsheet or database, or even Word, if you know how to work with
macros.

Collector       This is the main macro.  It searches for any .HPJ files
(fcollect.txt)  on your disk, puts them in a list, and lets you select
                the one from which you want the footnotes. Then it reads
                the .HPJ file to get the name of the files in your help
                project.
  
                If you're using the WHAT templates, RoboHelp, or another
                Help development system, you may have both .DOC and .RTF
                files. COLLECTOR gives you the option of reading the
                .DOC files (much faster!) or the .RTF files.  Then it
                goes through and parses out the footnotes.

                It knows about all the footnotes currently supported by
                the WinHelp engine in Win 3.1, including build tags,
                topic-entry macros, comments, et al.

                Keywords are stored as a single field, with all the
                entries and semi-colons embedded within it.  Originally
                I did this just to get the rest of the macro working,
                but ran into so many memory problems I left this as a
                separate macro (KeyCollector, see below).

                At this time, it doesn't deal with multiple keyword
                footnotes, nor with alternate keyword entries.

                CAVEAT ABOUT MEMORY!!!  When I first created the macro,
                it kept running out of memory if you ran it on more than
                7 files. Apparently every instance of copying, pasting,
                or deleting causes Word to lose a little memory.  I was
                doing a lot of that, and paid the price. I rewrote the
                macro to avoid any editing functions, except for a
                couple of situations I couldn't get around, and
                immediately was able to run the macro on 16 of the 23
                files.

                I've worked on it some more, and only have memory
                problems on one set of files now.  Funny thing:  both my
                large projects have 23 files, yet COLLECTOR goes through
                one without problem, and stops after 16 files on the
                other.  SysMeter says it's not really running out of
                memory anymore, but I've given up on further solutions.

                (6/28) You won't have this problem if you upgrade to
                WinWord 2.0c.  A lot of bugs have been fixed in that
                release.

FootnoteReader  This is a macro which will read in TRACKER.CSV and make
(fread.txt)     a table out of it.  It turns out to be faster to load it
                into Excel, save it as a spreadsheet, and load the
                spreadsheet into Word.  But it's less hassle (one
                command!) to just run this macro.

                When it's done, you have to set the table cell sizes
                yourself, and delete the columns that don't interest
                you.

KeyCollector    Though the keywords are separated by semi-colons, all
(keyword.txt)   keywords for a given topic are stored in TRACKER.CSV as
                a single field, surrounded by quotes. KeyCollector reads
                TRACKER.CSV and parses out the keywords.  It writes the
                keywords to the file KEYS.CSV.

                Though it reads all the fields, it only writes out the
                keyword, topic title, and filename on each line.  I
                found this more convenient to work with.  If you want to
                write out all the info, just locate the REM statements
                in the macro and change them as described there.

                CAVEAT:  It chokes on lines with more than 255
                characters in it.  Whether this is a problem depends
                entirely on how many key words you use.

                If you have keyword entries longer than 255 characters,
                you will find fields in KEYS.CSV with "String too long
                error" as the keyword entry.

                To get around this, you can use KEYS.BAS (see below).

                OTHER CAVEAT:  It sometimes runs out of memory on my
                largest files for no good reason I can see.  Try
                KEYS.BAS.

KEYS.EXE        Same as above, but is a QuickBasic program.  It runs
                MUCH more quickly than the WordBasic macro, won't choke
                if you have more than 255 characters on a line, and you
                can run it in a DOS window so it's not a big hassle.

                To install and use it:
                1)  Go to a DOS prompt or a DOS window.

                2)  Copy KEYS.EXE to the directory where TRACKER.CSV is located.

                3)  Type "keys".

                The file KEYS.CSV appears in the directory.

KeyThing        I wrote this macro on the spur of the moment.  It just
(keything.txt)  reads KEYS.CSV and puts it in a Word document.  It adds
                titles, sets up good tab and paragraph settings, and has
                an option to sort the file by keyword.  It's faster than
                a spreadsheet, and very easy to change to suit your
                needs.


INSTALLING A MACRO INTO A WORD FOR WINDOWS TEMPLATE

In this example, we'll install FCOLLECT.TXT as the macro Collector:

1)  Start Word.

2)  Choose the File menu, then Open, and open FCOLLECT.TXT.

3)  Press Ctrl-Shift-End (that is, press Ctrl, hold it down while
    pressing Shift, then hold them both down while pressing End).

    The entire document is selected.

4)  Press Ctrl-Insert.

    The text is now copied to the Clipboard.

5)  Choose the Tools menu, then Macro.

6)  In the dialog box, type Collector

    Make sure Global is selected in the lower right corner.

7)  Click Edit.

8)  A new macro document appears.

9)  Press Ctrl-Home, then Ctrl-Shift-End, then Shift-Ins.

    The text is replaced by the text from FCOLLECT.TXT.

10) Press Ctrl-F4 to close the document, and click Yes when asked if you
    want to keep the changes.

11) Repeat for the other macros.
