Building the Report Archive Page
In this chapter, Alexander will create a WSH-executed VBScript that creates an HTML page made up of links to all of the consolidated summary reports located in a report archive folder on the Intuit Web server. The report links will be organized and displayed by month. This page will also display a second set of links that provide visitors with the ability to view and download copies of the Microsoft Word versions of the consolidated summary reports.
Working with the Folder Object and the Files Collection
In order to develop the VBScript that will generate the Report Archive page, Alexander needs to learn how to work with both the Folder object and the Files Collection. To begin, he will need to establish a network connection to the shared folder on the Web server where the HTML versions of the consolidated summary reports are stored. Once this is done, he can use the FileSystem Object object's GetFolder() method to retrieve a reference to the shared folder. The syntax for the GetFolder() method is shown below.
ObjectReference.GetFolder(FolderName)
ObjectReference is the variable representing an instance of the FileSystem Object. FolderName specifies the name of the target folder.
Note |
If the specified folder does not exist, the GetFolder() method will return an error. Consider using the FolderExists() method to first see whether the folder exists before attempting to use the GetFolder() method. |
The reference set up by the GetFolder() method establishes a Folder object. Once established, your script can access all of the properties belonging to the Folder object. For example, the following VBScript statements demonstrate how to use the GetFolder() method to establish a reference to the C:Temp folder on the local computer.
Set FsoObj = CreateObject("Scripting.FileSystemObject") Set strTargetFile = FsoObj.GetFolder("c:Temp") MsgBox "Folder " & strTargetFile & " was last accessed on " & _ strTargetFile.DateLastAccessed
Once the reference is established (by strTargetFile), the Folder object's DateLastAccessed property is displayed. Figure 31.1 shows the output displayed by this example.
Figure 31.1: Using the Folder object's properties to access information about a folder
Once the Folder object has been established, you can use its Files property to retrieve a Files Collection. This collection will be made up of all the files that reside within the specified folder. For example, the following VBScript statements demonstrate how to list all of the files located within the C:Temp folder found on the local computer.
Set FsoObj = CreateObject("Scripting.FileSystemObject") Set strTargetFolder = FsoObj.GetFolder("c:Temp") Set strFileList = strTargetFolder.Files For Each x in strFileList strDisplayList = strDisplayList & x & vbCrLf Next MsgBox strDisplayList
The Files Collection (represented by strFileList) is established by assigning the value stored in the Folder object's Files property (represented by strTargetFolder.Files) to a variable. Once established, a For Each…Next loop is set up to iterate through the collection of files and build a display string. Figure 31.2 demonstrates the output produced by this example.
Figure 31.2: By looping through the Files Collection, you can programmatically process all the files stored within a specified folder
Alexander plans to use the GetFolder() method to set up a reference to the folder on the Web server where the HTML versions of the consolidated summary reports reside. He will then use the Folder object's Files property to establish a Files Collection for the folder. Once the collection is established, he can create a loop and use it to process each of the files in the folder (adding a link to the Report Archive page for each file in the collection).
Assembling the Report Archive Page
Alexander is now ready to begin work on the scripts that will automate the creation of the Report Archive page. As with his previous script, he plans to follow the organizational model developed by Molly. This will include providing support for a debug mode and for recording messages in the Windows application event log. Alexander will also add logic that provides a script return code.
The Initialization Section
The script's Initialization Section, shown below, begins by enforcing the strict interpretation of variable naming. It then defines all the variables used globally throughout the script and the Main Processing Section, including variables representing configuration settings—which will be extracted from the registry—and variables that represent the FileSystemObject, WshNetwork, and WshShell objects.
Option Explicit Dim strSharedFolder, strSharedFiles, strWordList, strArchiveFile Dim strWordFileName, intMonth, strMonth, intMonthStore Dim strEventLog, strDebug, strHTMLFolder, strSharedRptFolder, strWebSvrName Dim intReturnCode, intYearLoc, dtmYear Const cForReading = 1 Const cForWriting = 2 Const cForAppending = 8 Const cTitleBarMsg = "Archive Link Maintenance Script" Dim FsoObj, WshNtk, WshShl Set FsoObj = CreateObject("Scripting.FileSystemObject") Set WshNtk = WScript.CreateObject("WScript.Network") Set WshShl = WScript.CreateObject("WScript.Shell") intReturnCode = 0 intMonthStore = 0
Also defined is a collection of constants that specify file I/O options and the title bar message used in all pop-up dialog boxes created when the script is run in debug mode. Finally, the initial values are assigned to two variables. A zero is assigned to intReturnCode, representing the script's default return code. A zero is also assigned to intMonthStore. This variable is used in the Main Processing Section to determine when a new month-year subheading needs to be written on the HTML page.
The Main Processing Section
The script's Main Processing Section, shown on the following page, begins by calling the GetRegistrySettings() subroutine. This subroutine retrieves the script's configuration settings and provides it with information such as where to find the consolidated report archive and where to save the HTML file that it creates. Pop-up dialog boxes will display intermediate results using the MsgBox() function and will identify when key activities are occurring if the script is run in debug mode. Likewise, if event logging is enabled, informational messages will be recorded in the Windows application event log by the WriteToEventLog subroutine.
GetRegistrySettings() If strEventLog = "Enabled" Then WriteToEventLog("Archive Link Maintenance Script now executing.") End If If strDebug = "Enabled" Then MsgBox "Beginning development of the archive list.", , cTitleBarMsg End If Set strArchiveFile = FsoObj.OpenTextFile(strHTMLFolder & "Archive.html", _ cForWriting , "True") MapNetworkDrive "V:", "\" & strWebSvrName & "" & strSharedRptFolder Set strSharedFolder = FsoObj.GetFolder("V:") Set strSharedFiles = strSharedFolder.Files WriteHeader() WriteH3Heading() For Each strWordList In strSharedFiles If Instr(1, strWordList.Name, ".doc") = 0 Then int1stDash = InStr(1, strWordList.Name, "-") intLengthOfMonth = int1stDash - 1 intMonth = Left(strWordList.Name, intLengthOfMonth) If intMonth <> intMonthStore Then intYearLoc = Instr(1, strWordList.Name, "_") dtmYear = Mid(strWordList.Name, intYearLoc - 4, 4) intMonthStore = intMonth strMonth = MonthName(intMonth) strArchiveFile.WriteLine("
" & strMonth & " " & dtmYear & "
") End If strWordFileName = Replace(strWordList.Name, "html", "doc" ) strArchiveFile.WriteLine("<a href="../">" & strWordList.Name & "</a>" & " - " & "<a href="../">(Download Word Version) </a>
") End If Next DisconnectNetworkDrive("V:") WriteFooter() If strDebug = "Enabled" Then MsgBox "Archive list now completed.", , cTitleBarMsg End If If strEventLog = "Enabled" Then WriteToEventLog ("Archive Link Maintenance Script finished executing.") End If TerminateScript(intReturnCode)
The next activity performed in the Main Processing Section is instantiation of the variable representing the Archive.html file, which the script is creating. Next, the MapNetworkDrive() function is called to set up a network connection to the shared folder where HTML versions of the consolidated summary reports reside (on the Web server). Then the GetFolder() method is used to set up a working reference to the shared folder. Once this is done, a Files Collection is set up and associated with a variable called strSharedFiles.
At this point, writing the new HTML page can start. First, the WriteHeader() subroutine is called. This subroutine writes the HTML page's opening set of HTML tags. Then the WriteH3Heading() subroutine is called to write the page's main header. A For Each…Next loop is then used to process the files residing in the previously created Files Collection.
The loop begins by filtering out any files that have a .doc file extension, leaving only the HTML files for processing. The next three statements figure out the month with which the file is associated. The statements find the location of the first occurrence of the dash character within the file name, subtract 1, and then use the Left() function to set intMonth equal to the one- or two-character month value. The value of this variable is then compared to the value of intMonthStore (which is set equal to zero when the script first starts executing). If the values are different, the name of the month and the year in which the month occurs are written (in bold) to the HTML page as a section heading. In addition, the value of intMonth is set equal to the value of intMonthStore, thus ensuring that a new month-year header will be written if the loop later processes an HTML file that was created in a different month.
Next, the Replace() function is used to assign the name of the HTML page's corresponding Word report file and the WriteLine() method is used to write a string. The first portion of this string represents a link to the archive HTML file with which the link is associated. Its location is specified relative to the location of the script. The second portion of the string represents a link to the associated Word version of the archived report.
The Main Processing Section finishes up by calling the DisconnectNetworkDrive() subroutine, which breaks the mapped drive connection that the script set up in order to retrieve the Files Collection. Next the WriteFooter() subroutine is called in order to write the HTML page's closing HTML tags, and then the TerminateScript() procedure is executed.
The GetRegistrySettings() Subroutine
As with Alexander's previous script, the GetRegistrySettings() subroutine, shown below, retrieves the script's configuration settings from the Windows registry.
Sub GetRegistrySettings() On Error Resume Next strEventLog = _ WshShl.RegRead("HKLMSoftwareIntuitVBScriptsWebRptingEventLogging") If Err <> 0 Then If strEventLog = "Enabled" Then WriteToEventLog ("HTML Report Conversion Script - Using default " & _ "for strEventLog. RC = 4") TerminateScript(12) End If End If strDebug = WshShl.RegRead("HKLMSoftwareIntuitVBScriptsWebRptingDebug") If Err <> 0 Then If strEventLog = "Enabled" Then WriteToEventLog ("HTML Report Conversion Script - Using default " & _ "for strDebug. RC = 4") TerminateScript(12) End If End If strHTMLFolder = _ WshShl.RegRead("HKLMSoftwareIntuitVBScriptsWebRptingHTMLFolder") If Err <> 0 Then If strEventLog = "Enabled" Then WriteToEventLog ("HTML Report Conversion Script - Using default " & _ "for strHTMLFolder. RC = 4") TerminateScript(12) End If End If strSharedRptFolder = _ WshShl.RegRead("HKLMSoftwareIntuitVBScriptsWebRptingShare_Rpts") If Err <> 0 Then If strEventLog = "Enabled" Then WriteToEventLog ("HTML Report Conversion Script - Using default " & _ "for strSharedRptFolder. RC = 4") TerminateScript(12) End If End If strWebSvrName = _ WshShl.RegRead("HKLMSoftwareIntuitVBScriptsWebRptingWebServer") If Err <> 0 Then If strEventLog = "Enabled" Then WriteToEventLog ("HTML Report Conversion Script - Using default " & _ "for strWebSvrName. RC = 4") TerminateScript(12) End If End If If strDebug = "Enabled" Then MsgBox "Registry settings initialized: " & vbCrLf & vbCrLf & _ "strEventLog" & vbTab & "=" & vbTab & strEventLog & vbCrLf & _ "strDebug" & vbTab & vbTab & "=" & vbTab & strDebug & vbCrLf & _ "strHTMLFolder" & vbTab & "=" & vbTab & strHTMLFolder & vbCrLf & _ "strSharedRptFolder" & vbTab & "=" & vbTab & strSharedRptFolder & _ vbCrLf & "strWebSvrName" & vbTab & "=" & vbTab & strWebSvrName & _ vbCrLf, ,cTitleBarMsg End If End Sub
The WriteHeader() Subroutine
The WriteHeader() subroutine, shown below, is responsible for writing the HTML page's open HTML tags and for specifying an opening tag, which specifies the Courier font. This font was selected because it prints every character using a consistent character size, which will help provide for a consistent presentation of report data.
Sub WriteHeader() strArchiveFile.WriteLine("
") strArchiveFile.WriteLine(" ") strArchiveFile.WriteLine("Environment Variables") strArchiveFile.WriteLine("") strArchiveFile.WriteLine("
The WriteH3Heading() Subroutine
The WriteH3Heading() subroutine, shown on the following page, writes an
level HTML heading to the HTML page, representing the page's title.
Sub WriteH3Heading() strArchiveFile.WriteLine("
Order/Inventory Reporting Archive
") End Sub
The WriteFooter() Subroutine
The WriteFooter() subroutine, shown below, writes the HTML page's closing HTML tags, including a closing tag.
Sub WriteFooter() strArchiveFile.WriteLine(" ") strArchiveFile.WriteLine(" ") strArchiveFile.WriteLine("") End Sub
The MapNetworkDrive() Function
The MapNetworkDrive() function, shown below, is responsible for establishing a network connection to the shared folder on the corporate Web server, where the archived copies of the HTML versions of the consolidated summary reports are stored.
Function MapNetworkDrive(strLetter, strDrive) If strDebug = "Enabled" Then MsgBox "strLetter = " & strLetter & vbCrLf & "strDrive = " & _ strDrive, , cTitleBarMsg End If If FsoObj.DriveExists(strDrive) Then If strDebug = "Enabled" Then MsgBox strDrive & " exists", , cTitleBarMsg End If If FsoObj.DriveExists(strLetter) Then If strDebug = "Enabled" Then MsgBox "Deleting drive letter " & strLetter, , cTitleBarMsg End If WshNtk.RemoveNetworkDrive strLetter End If WshNtk.MapNetworkDrive strLetter, strDrive Else If strDebug = "Enabled" Then MsgBox strDrive & " does not exist", , cTitleBarMsg End If If strEventLog = "Enabled" Then WriteToEventLog "Summary Report Collection script - Unable to map " & _ "to network drive " & strDrive End If TerminateScript(4) End If End Function
The drive letter to be used to set up the network connection and the path to the remote folder are passed to the function as arguments. The FileSystemObject object's DriveExists() method is used to determine whether or not the remote drive is available. If it is not available, the TerminateScript() subroutine is called and passed a value of 4, representing the script's return code. If the network drive is accessible, the function next checks to make sure that the specified drive letter is not already in use. If it is, its connection is disconnected using the RemoveNetworkDrive() method and the connection to the shared folder on the Web server is created using the MapNetworkDrive() method.
The DisconnectNetworkDrive() Subroutine
The DisconnectNetworkDrive() subroutine, shown on the next page, disconnects a network drive connection using the WshNetwork object's RemoveNetworkDrive() method. The connection to be terminated is specified by a variable called strDriveLetter, which is passed to the subroutine as an argument.
Sub DisconnectNetworkDrive(strDriveLetter) On Error Resume Next If strDebug = "Enabled" Then MsgBox "Disconnecting " & strDriveLetter, , cTitleBarMsg End If WshNtk.RemoveNetworkDrive strDriveLetter If Err <> 0 Then If strDebug = "Enabled" Then MsgBox "Error occurred when disconnecting " & strDriveLetter, , _ cTitleBarMsg End If End If End Sub
The WriteToEventLog() Subroutine
The WriteToEventLog() subroutine, shown below, writes a message which is passed to it as an argument to the Windows application event log.
Sub WriteToEventLog(strMessage) WshShl.LogEvent 4, strMessage End Sub
The TerminateScript() Subroutine
The TerminateScript() subroutine, shown on the following page, uses the WScript object's Quit() method to halt the script's execution. In addition, it passes a script return code (indicating whether or not the script ran successfully) back to its calling script. This return code is passed to it as an argument called intRC, which is initially set equal to zero at the beginning of the script's execution.
Sub TerminateScript(intRC) If strDebug = "Enabled" Then MsgBox "Script execution terminated.", , cTitleBarMsg End If WScript.Quit(intRC) End Sub
The Fully Assembled Script
The fully assembled script, shown below, creates the Report Archive page by connecting to the corporate Web server in order to collect a list of the currently available HTML consolidated summary report files. It then builds an HTML page by creating a link for each file that is found. A second set of links is added for the Word versions of the reports, allowing visitors to view and download formal copies of the reports.
'************************************************************************* 'Script Name: Script 31.1.vbs 'Author: Jerry Ford 'Created: 05/06/03 'Description: This script creates an HTML page that provides a list of 'links to old Order/Inventory consolidated reports. '************************************************************************* 'Initialization Section Option Explicit Dim strSharedFolder, strSharedFiles, strWordList, strArchiveFile Dim strWordFileName, intMonth, strMonth, intMonthStore Dim strEventLog, strDebug, strHTMLFolder, strSharedRptFolder, strWebSvrName Dim intReturnCode, intYearLoc, dtmYear Const cForReading = 1 Const cForWriting = 2 Const cForAppending = 8 Const cTitleBarMsg = "Archive Link Maintenance Script" Dim FsoObj, WshNtk, WshShl Set FsoObj = CreateObject("Scripting.FileSystemObject") Set WshNtk = WScript.CreateObject("WScript.Network") Set WshShl = WScript.CreateObject("WScript.Shell") intReturnCode = 0 intMonthStore = 0 'Main Processing Section GetRegistrySettings() If strEventLog = "Enabled" Then WriteToEventLog("Archive Link Maintenance Script now executing.") End If If strDebug = "Enabled" Then MsgBox "Beginning development of the archive list.", , cTitleBarMsg End If Set strArchiveFile = FsoObj.OpenTextFile(strHTMLFolder & "Archive.html", _ cForWriting , "True") MapNetworkDrive "V:", "\" & strWebSvrName & "" & strSharedRptFolder Set strSharedFolder = FsoObj.GetFolder("V:") Set strSharedFiles = strSharedFolder.Files WriteHeader() WriteH3Heading() For Each strWordList In strSharedFiles If Instr(1, strWordList.Name, ".doc") = 0 Then int1stDash = InStr(1, strWordList.Name, "-") intLengthOfMonth = int1stDash - 1 intMonth = Left(strWordList.Name, intLengthOfMonth) If intMonth <> intMonthStore Then intYearLoc = Instr(1, strWordList.Name, "_") dtmYear = Mid(strWordList.Name, intYearLoc - 4, 4) intMonthStore = intMonth strMonth = MonthName(intMonth) strArchiveFile.WriteLine("
" & strMonth & " " & dtmYear & "
") End If strWordFileName = Replace(strWordList.Name, "html", "doc" ) strArchiveFile.WriteLine("<a href="../">" & strWordList.Name & "</a>" & " - " & "<a href="../">(Download Word Version) </a>
") End If Next DisconnectNetworkDrive("V:") WriteFooter() If strDebug = "Enabled" Then MsgBox "Archive list now completed.", , cTitleBarMsg End If If strEventLog = "Enabled" Then WriteToEventLog ("Archive Link Maintenance Script finished executing.") End If TerminateScript(intReturnCode) 'Procedure Section Sub GetRegistrySettings() On Error Resume Next strEventLog = _ WshShl.RegRead("HKLMSoftwareIntuitVBScriptsWebRptingEventLogging") If Err <> 0 Then If strEventLog = "Enabled" Then WriteToEventLog ("HTML Report Conversion Script - Using default " & _ "for strEventLog. RC = 4") TerminateScript(12) End If End If strDebug = WshShl.RegRead("HKLMSoftwareIntuitVBScriptsWebRptingDebug") If Err <> 0 Then If strEventLog = "Enabled" Then WriteToEventLog ("HTML Report Conversion Script - Using default " & _ "for strDebug. RC = 4") TerminateScript(12) End If End If strHTMLFolder = _ WshShl.RegRead("HKLMSoftwareIntuitVBScriptsWebRptingHTMLFolder") If Err <> 0 Then If strEventLog = "Enabled" Then WriteToEventLog ("HTML Report Conversion Script - Using default " & _ "for strHTMLFolder. RC = 4") TerminateScript(12) End If End If strSharedRptFolder = _ WshShl.RegRead("HKLMSoftwareIntuitVBScriptsWebRptingShare_Rpts") If Err <> 0 Then If strEventLog = "Enabled" Then WriteToEventLog ("HTML Report Conversion Script - Using default " & _ "for strSharedRptFolder. RC = 4") TerminateScript(12) End If End If strWebSvrName = _ WshShl.RegRead("HKLMSoftwareIntuitVBScriptsWebRptingWebServer") If Err <> 0 Then If strEventLog = "Enabled" Then WriteToEventLog ("HTML Report Conversion Script - Using default " & _ "for strWebSvrName. RC = 4") TerminateScript(12) End If End If If strDebug = "Enabled" Then MsgBox "Registry settings initialized: " & vbCrLf & vbCrLf & _ "strEventLog" & vbTab & "=" & vbTab & strEventLog & vbCrLf & _ "strDebug" & vbTab & vbTab & "=" & vbTab & strDebug & vbCrLf & _ "strHTMLFolder" & vbTab & "=" & vbTab & strHTMLFolder & vbCrLf & _ "strSharedRptFolder" & vbTab & "=" & vbTab & strSharedRptFolder & _ vbCrLf & "strWebSvrName" & vbTab & "=" & vbTab & strWebSvrName & _ vbCrLf, ,cTitleBarMsg End If End Sub Sub WriteHeader() strArchiveFile.WriteLine("
") strArchiveFile.WriteLine("") strArchiveFile.WriteLine("Environment Variables") strArchiveFile.WriteLine("") strArchiveFile.WriteLine("") strArchiveFile.WriteLine(" ") End Sub Sub WriteH3Heading() strArchiveFile.WriteLine("
Order/Inventory Reporting Archive
") End Sub Sub WriteFooter() strArchiveFile.WriteLine(" ") strArchiveFile.WriteLine(" ") strArchiveFile.WriteLine("") End Sub Function MapNetworkDrive(strLetter, strDrive) If strDebug = "Enabled" Then MsgBox "strLetter = " & strLetter & vbCrLf & "strDrive = " & _ strDrive, , cTitleBarMsg End If If FsoObj.DriveExists(strDrive) Then If strDebug = "Enabled" Then MsgBox strDrive & " exists", , cTitleBarMsg End If If FsoObj.DriveExists(strLetter) Then If strDebug = "Enabled" Then MsgBox "Deleting drive letter " & strLetter, , cTitleBarMsg End If WshNtk.RemoveNetworkDrive strLetter End If WshNtk.MapNetworkDrive strLetter, strDrive Else If strDebug = "Enabled" Then MsgBox strDrive & " does not exist", , cTitleBarMsg End If If strEventLog = "Enabled" Then WriteToEventLog "Summary Report Collection script - Unable to map " & _ "to network drive " & strDrive End If TerminateScript(4) End If End Function Sub DisconnectNetworkDrive(strDriveLetter) On Error Resume Next If strDebug = "Enabled" Then MsgBox "Disconnecting " & strDriveLetter, , cTitleBarMsg End If WshNtk.RemoveNetworkDrive strDriveLetter If Err <> 0 Then If strDebug = "Enabled" Then MsgBox "Error occurred when disconnecting " & strDriveLetter, , _ cTitleBarMsg End If End If End Sub Sub WriteToEventLog(strMessage) WshShl.LogEvent 4, strMessage End Sub Sub TerminateScript(intRC) If strDebug = "Enabled" Then MsgBox "Script execution terminated.", , cTitleBarMsg End If WScript.Quit(intRC) End Sub
The Content of the HTML File
The end result of executing this chapter's VBScript is the creation of an HTML page that contains links to all of the consolidated summary reports stored on the Web server. The following listing shows an example of an HTML page created by the VBScript. To make the example easier to view, all but the first three days' worth of entries for each month have been deleted.
Environment Variables
Order/Inventory Reporting Archive
May 2003
<a href="../Rpts5-1-2003_ConsolSumRpt.html">5-1-2003_ConsolSumRpt.html</a> - <a href="../Rpts5-1-2003_ConsolSumRpt.doc"> (Download Word Version) </a>
<a href="../Rpts5-2-2003_ConsolSumRpt.html">5-2-2003_ConsolSumRpt.html</a> - <a href="../Rpts5-2-2003_ConsolSumRpt.doc"> (Download Word Version) </a>
<a href="../Rpts5-3-2003_ConsolSumRpt.html">5-3-2003_ConsolSumRpt.html</a> - <a href="../Rpts5-3-2003_ConsolSumRpt.doc"> (Download Word Version) </a>
June 2003
<a href="../Rpts6-1-2003_ConsolSumRpt.html">6-1-2003_ConsolSumRpt.html</a> - <a href="../Rpts6-1-2003_ConsolSumRpt.doc"> (Download Word Version) </a>
<a href="../Rpts6-2-2003_ConsolSumRpt.html">6-2-2003_ConsolSumRpt.html</a> - <a href="../Rpts6-2-2003_ConsolSumRpt.doc"> (Download Word Version) </a>
<a href="../Rpts6-3-2003_ConsolSumRpt.html">6-3-2003_ConsolSumRpt.html</a> - <a href="../Rpts6-3-2003_ConsolSumRpt.doc"> (Download Word Version) </a>
July 2003
<a href="../Rpts7-1-2003_ConsolSumRpt.html">7-1-2003_ConsolSumRpt.html</a> - <a href="../Rpts7-1-2003_ConsolSumRpt.doc"> (Download Word Version) </a>
<a href="../Rpts7-2-2003_ConsolSumRpt.html">7-2-2003_ConsolSumRpt.html</a> - <a href="../Rpts7-2-2003_ConsolSumRpt.doc"> (Download Word Version) </a>
<a href="../Rpts7-3-2003_ConsolSumRpt.html">7-3-2003_ConsolSumRpt.html</a> - <a href="../Rpts7-3-2003_ConsolSumRpt.doc"> (Download Word Version) </a>
August 2003
<a href="../Rpts8-1-2003_ConsolSumRpt.html">8-1-2003_ConsolSumRpt.html</a> - <a href="../Rpts8-1-2003_ConsolSumRpt.doc"> (Download Word Version) </a>
<a href="../Rpts8-2-2003_ConsolSumRpt.html">8-2-2003_ConsolSumRpt.html</a> - <a href="../Rpts8-2-2003_ConsolSumRpt.doc"> (Download Word Version) </a>
<a href="../Rpts8-3-2003_ConsolSumRpt.html">8-3-2003_ConsolSumRpt.html</a> - <a href="../Rpts8-3-2003_ConsolSumRpt.doc"> (Download Word Version) </a>
On the first day of each month, the archive management script (which will be developed in the next chapter) clears out any reports older than three months old. As the month progresses, the size of the archive being maintained will expand to hold four months' worth of reports. As you can see, the report displays entries for May through August.
Figure 31.3 provides an example of how the Report Archive page will look when viewed from the Order/Inventory Reporting Web site. (Again, the size of the report has been reduced to make it easier to view.)
Figure 31.3: Reviewing the collection of consolidated summary reports maintained on the corporate Web server
Figure 31.4 shows an example of an archive consolidated summary report that has been selected for viewing from the Report Archive page.
Figure 31.4: Any of the consolidated summary reports listed on the Report Archive page are available for online viewing
In addition to the HTML versions of the consolidated summary reports, an archive of Word versions of the reports is maintained. By clicking on the Download Word Version link on the Report Archive page, visitors can view and opt to download a Word copy of each archived report. Figure 31.5 shows an example of one such report.
Figure 31.5: Examining the Word version of an archived copy of one of the consolidated summary reports
Summary
In this chapter, you observed as Alexander created a VBScript run by the WSH that built an HTML page. This page provided a list of links to each of the consolidated summary reports stored in an archive folder on the corporate Web server at Intuit. He also added links to the page that made copies of the Word versions of the consolidated summary reports available to visitors.