Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.
On Error Resume Next Dim fso, folder, NewsFile,sFolder, files Dim counter Dim filenames() Set fso = CreateObject("Scripting.FileSystemObject") sFolder = "c:\test" If sFolder = "" Then Wscript.Echo "No Folder parameter was passed" Wscript.Quit End If 'Set NewFile = fso.CreateTextFile(sFolder&"\FileList.txt", True) Set folder = fso.GetFolder(sFolder) Set files = folder.Files counter = 0 ' load requests into array For each textfile In files ReDim Preserve filenames(counter) filenames(counter) = textfile.Name counter = counter + 1 Next ' build & display msgbox text for current requests Dim strMsgboxtext strMsgboxtext = "There are " & counter & " requests to process. Please click OK to continue." & vbcrlf for i = 0 to counter strMsgboxtext = strMsgboxtext & vbcrlf & filenames(i) next msgbox(strMsgboxtext) 'msgbox "There are " & counter & " requests to process. Please click OK to continue." Set objFSO = CreateObject("Scripting.FileSystemObject") for j = 0 to counter msgbox("Please click OK to process request #" & counter & ": " & filenames(counter)) ' read information from current request Set objFile = objFSO.OpenTextFile("c:\test\" & filenames(j), ForReading) Const ForReading = 1 ' dim array to store contents of current request Dim arrFileLines() ' load contents of current request into array k = 0 Do Until objFile.AtEndOfStream Redim Preserve arrFileLines(k) arrFileLines(k) = objFile.ReadLine k = k + 1 Loop objFile.Close ' init msgbox text to display contents of current request Dim strMsgboxtext2 strMsgboxtext2 = "displaying contents of request #" & j+1 & ": " & vbcrlf & vbcrlf ' build msgbox text to display contents of current request (k = number of lines in request) For l = 0 to k strMsgboxtext2 = strMsgboxtext2 & arrFileLines(l) & vbcrlf Next ' show contents of current request msgbox(strMsgboxtext2) Next ' call next script Set WSHShell = CreateObject("WScript.Shell") WSHShell.Run "wscript c:\users\administrator\desktop\test.vbs", , True ' indicate script is complete msgbox("script complete") 'NewFile.Close
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.