' script reads all Header files in passed directory ' and generates list of WinRunner scripts' parameters list Call main Sub main() file_name = "header" strScriptPath = InputBox("Search directory (without tailing slash)", "Directory", "..\Regression_Tests") If strScriptPath = "" Then MsgBox "Script was canceled", vbInformation Exit Sub End If output_file = InputBox("Output file name", "Files to store", "script_list.txt") If output_file = "" Then MsgBox "Script was canceled", vbInformation Exit Sub End If Set fso = CreateObject("Scripting.FileSystemObject") ' Create a FileSystemObject parts = Split(strScriptPath, "\") cmd = "dir " & strScriptPath & "\" & file_name & " /S /B >" & strScriptPath & "\scriptfile.tmp" ' Command to be executed Set WshShell = CreateObject("WScript.Shell") ' Create a WshShell object... WshShell.Run "%comspec% /c " & cmd, 0, True ' ...and DOS command that redirects the output to the "headfile.txt" file ' The MS-DOS command is finished. A temporary file ' now exists containing the output of the dir command. Set DirFiles = fso.OpenTextFile(strScriptPath & "\scriptfile.tmp") Set DirFilet = fso.OpenTextFile(strScriptPath & "\scriptfile1.tmp", 2, True) Set fso = CreateObject("Scripting.FileSystemObject") Do While Not (DirFiles.atEndOfStream) ' Read the file with header file list Header = DirFiles.ReadLine Set DirFile = fso.OpenTextFile(Header) Do While Not (DirFile.atEndOfStream) ' Read the script header file content DirFilet.WriteLine DirFile.ReadLine Loop Loop Set DirFiles = fso.OpenTextFile(strScriptPath & "\scriptfile1.tmp") Set DirFilet = fso.OpenTextFile(output_file, 2, True) Script = "Script" ' prepare column headings params = "Parameters12" ' last two characters for params will be removed later Do While Not (DirFiles.atEndOfStream) ' read by line Line = DirFiles.ReadLine If Left(Line, 5) = "NAME=" Then If params <> "" Then params = Left(params, Len(params) - 2) ' cut last ", " 'DirFilet.WriteLine script & chr(9) & params DirFilet.WriteLine Script & "(" & params & ")" params = "" parts = Split(Line, "\") Script = parts(UBound(parts)) If fso.FileExists(strScriptPath & "\" & Script & "\script") = False Then msgbox "Script catalog '" & Script & "' doesn't exist! Check content of the header file!", vbExclamation End If End If If Left(Line, 5) = "NAME_" Then params = params & Mid(Line, 8) & ", " Loop DirFiles.Close ' Close files DirFilet.Close fso.DeleteFile strScriptPath & "\scriptfile.tmp" ' Delete temp file. fso.DeleteFile strScriptPath & "\scriptfile1.tmp" ' Delete temp file. MsgBox "Sript parameters list is stored in:" & output_file, vbInformation, "Job finished" End Sub