Submitted By: Phil Wills

Creates a table of links that can be imported into an HTML or ASP file.

Visual Basic
Edit|Remove
FOLDER = "C:\Job Descriptions"
OUTFILE = "C:\linktable.html"
PREFIX = "job_desc\"

set fso = CreateObject("Scripting.FileSystemObject")

Set htmlout = fso.CreateTextFile(OUTFILE, True)

htmlout.WriteLine("  <table>")

set f = fso.GetFolder(folder)
set fc = f.Files

colcount = 0
for each fl in fc
	fname = fso.GetBaseName(fl)

	if colcount = 0 Then
		htmlout.WriteLine("    <tr>")
	End If

	htmlout.WriteLine("      <td><a href=""" + PREFIX + fl.Name + _
		""" target=""_blank"">" + fname + "</a></td>")
	
	colcount = colcount + 1

	if colcount = 3 Then
		htmlout.WriteLine("    </tr>")
		colcount = 0
	end if
next

if colcount <> 0 Then
	While colcount < 3
		htmlout.WriteLine("      <td>&nbsp;</td>")
		colcount = colcount + 1
	Wend

	htmlout.WriteLine("    </tr>")
End If

htmlout.WriteLine("  </table>")
htmlout.Close
Set htmlout = Nothing
Set fso = Nothing
wscript.echo "Done!"