'Creates a text report having the same name as the VBS file (but 'with TXT extension) documenting all VBS and ASP functions and 'subs. The script documents everything in and under it's directory. 'The script does NOT document itself! Option Explicit Const EXTENSIONS = "asp,vbs" 'EXTENSIONS constant is comma-delimited list of extensions 'to search. Const LINE_START = "Function ,Sub " 'LINE_START constant is comma-delimited list of words to look 'for at the beginning of each line. Be sure to include the 'trailing space if appropriate. Dim fs Set fs = CreateObject("Scripting.FileSystemObject") ProcessDirectory(fs.GetParentFolderName(WScript.ScriptFullName)) Sub ProcessDirectory(strDirectory) Dim subfol, fol, fols, fil, fils, strExt Set fol = fs.GetFolder(strDirectory) Set fols = fol.SubFolders For Each subfol In fols ProcessDirectory subfol.Path 'recursive Next Set fils = fol.Files For Each fil In fils If InStr(fil.Name, ".") <> 0 Then For Each strExt In Split(EXTENSIONS, ",") If Lcase(Right(fil.Name, Len(strExt) + 1)) = LCase("." & strExt) Then If Lcase(fil.Path) <> Lcase(WScript.ScriptFullName) Then ProcessFile(fil.Path) End If End If Next End If Next End Sub Sub ProcessFile(strFile) Dim ts, strData, strStart Const ForReading = 1 Set ts = fs.OpenTextFile(strFile, ForReading, False) Do While Not ts.AtEndOfStream strData = ts.ReadLine For Each strStart In Split(LINE_START, ",") If Lcase(Left(strData, Len(strStart))) = Lcase(strStart) Then AppendLog strFile & vbTab & strData End If Next Loop ts.Close End Sub Sub AppendLog(strText) Dim ts Const ForAppending = 8 Set ts = fs.OpenTextFile(Left(Wscript.ScriptFullName, InstrRev(Wscript.ScriptFullName, ".")) & "txt", ForAppending, True) ts.WriteLine strText ts.Close End Sub