Scripting Comments
Create Documentation Based on Script CommentsDelete Debugging Comments
You can use any of the VBScript programs below in ActiveXperts Network Monitor. Click here for an explanation about how to include scripts in ActiveXperts Network Monitor.
Create Documentation Based on Script Comments
Demonstrates the use of the FileSystemObject as a way to copy comments from a script to a separate text file. Requires comments to have been marked using '*.
Const ForReading = 1 Const ForWriting = 2 Set objFSO = CreateObject("Scripting.FileSystemObject") Set objScriptFile = objFSO.OpenTextFile("c:\scripts\Service_Monitor.vbs", _ ForReading) Set objCommentFile = objFSO.OpenTextFile("c:\scripts\Comments.txt", _ ForWriting, TRUE) Do While objScriptFile.AtEndOfStream <> TRUE strCurrentLine = objScriptFile.ReadLine intIsComment = Instr(1,strCurrentLine,"'*") If intIsComment > 0 Then objCommentFile.Write strCurrentLine & VbCrLf End If Loop objScriptFile.Close objCommentFile.Close
Delete Debugging Comments
Demonstrates the use of the FileSystemObject as a way to remove debugging comments from a script. Requires comments to have been marked as '* BUG.
Const ForReading = 1 Const ForWriting = 2 Set objFSO = CreateObject("Scripting.FileSystemObject") Set objTextFile = objFSO.OpenTextFile("C:\Scripts\CreateUser.vbs", ForReading) Do While objTextFile.AtEndOfStream <> true strNextLine = objTextFile.Readline intCheckForBugComment = Instr(strNextLine, "'* BUG") If intCheckForBugComment = 0 Then strSavedLines = strSavedLines & strNextLine & VbCrLf End If Loop Set objTextFile = objFSO.OpenTextFile _ ("c:\scripts\CreateUser.vbs ", ForWriting) objTextFile.Write strSavedLines objTextFile.Close