How to generate a huge list of Macs from MacTracker, and format it into a webpage

(Note that the general procedures here apply to any folder with subfolders and files that you want to transform into an HTML table.)

  1. Right-click or ctrl-click on the MacTracker application and select "Show Package Contents."

  2. Open Contents->Resources->iPod and copy "MactrackeriPod.tgz" to the Desktop.

  3. Extract "MactrackeriPod.tgz" (double-click). It will make a folder called "MacTracker" on the Desktop.

  4. Open Terminal and type:
    cd Desktop/MacTracker
    ls -R > ~/Desktop/big-dang-list
    (What this means: From within the MacTracker directory, show a list all files and subfolder contents, recursively, and write the output of that list to a file called "big-dang-list".)

  5. Open that list in a text editor with a find/change function (BBEdit). It will look like:
    About Mactracker
    AirPort Stations
    Classic Macintosh
    Mac OS
    Mac Pro
    Mac mini
    MacBook-MacBook Pro
    Macintosh Clones
    Power Mac G3-G4-G5
    Power Macintosh
    PowerBook G3-G4
    Workgroup-Mac Servers
    Xserve-Xserve RAID
    ./AirPort Stations:
    AP BS (Dual Ethernet)
    AP BS (Graphite)	
    APE BS (PoE-UL 2043)
    APE BS (with Modem)
    APE Base Station
    AirPort Express
    QT VC Camera 100
    QuickTake 100
    QuickTake 150
    QuickTake 200
    ./Classic Macintosh:
    Mac 128k
    Mac 512k-512ke
    Mac Centris 610
    Get rid of the first, topmost list (it's just the directory names).

  6. This is where it gets tricky. First, do a find/change for:
    In other words, wherever there is a carriage return, turn it into the HTML for ending a table cell, creating another cell with a [  ] in it (this will be where I put the checkmarks for the machines I have), end THAT cell, end the row, retain the carriage return for readability, start a new row and a new cell.

  7. Next, do another find/change for:
    <tr><td colspan="2"><b>

    And then:

    All the directory names start with ./ (Unix-ese for "in this directory") and end with a colon. They do double-duty here as category names, so we want to boldface them and make them stretch across both columns.

    Last major find/change:

    <tr><td colspan="2">&nbsp;</td></tr>
    Gets rid of the extra checkbox and turns it into a blank line (empty row) for spacing.

  8. Manual cleanup -- you will have to manually fix the first and last lines of the file, since the first is missing a CR and the last has one too many.

  9. Add opening and closing <table> tags, apply styles as you see fit.

  10. Now you have one loooooong skinny table. To make two columns, simply add an enclosing table with one row and two cells, and put approximately half of the list in each cell.

  11. Now go through and replace the [&nbsp;&nbsp;]'s with [&#10003;] -- the HTML entity for a checkmark -- wherever you want to check off an item.

The only bummer here is that the initial list generated by ls -R is in alphabetical order, not in the nice chronological order of the MacTracker interface. Oh well.

Back to the big list