Login | |
|
 |
RE: newbie - Searching for a file and outputing the res... - 7/25/2005 10:29:09 AM
|
|
 |
|
| |
Country73
Posts: 712
Score: 8
Joined: 8/25/2004
From: USA
Status: offline
|
Welcome to the VBScript Forum! Are you wanting to add a step inside of your script to where it will display the error in a msgbox while also creating your errormsg.txt? Or are you looking for a script that will search for the errormsg.txt and then pull the information out into a msgbox?
|
|
| |
|
|
|
 |
RE: newbie - Searching for a file and outputing the res... - 7/26/2005 3:15:24 AM
|
|
 |
|
| |
Country73
Posts: 712
Score: 8
Joined: 8/25/2004
From: USA
Status: offline
|
If the one you have now is not working, can you show what you're using? (May just need to tweak the one you have instead of re-creating it)
|
|
| |
|
|
|
 |
RE: newbie - Searching for a file and outputing the res... - 7/28/2005 12:38:25 AM
|
|
 |
|
| |
Country73
Posts: 712
Score: 8
Joined: 8/25/2004
From: USA
Status: offline
|
Sorry for the delay in getting back to you. I'll see what I can do on throwing a script together to search through folders until it finds the "errormsg.txt", then check to see if the errormsg.txt is blank or not. Hopefully it won't take too long to throw this together, just as long as things don't get too overwhelming here at work. Country73
|
|
| |
|
|
|
 |
RE: newbie - Searching for a file and outputing the res... - 7/28/2005 1:08:39 AM
|
|
 |
|
| |
Country73
Posts: 712
Score: 8
Joined: 8/25/2004
From: USA
Status: offline
|
OK, this should take care of it for you. This script was supplied by Xandros, here at the forum, which I just had to do a little modification on. The only thing you should have to do is change the directory path. '--------------------------------------------------------------------------------------------------- Set fso = CreateObject("Scripting.FileSystemObject") Const FIL = "errormsg.txt" 'File we are looking for DirWalk("C:\Documents and Settings") 'Change this to what you need Sub DirWalk(parmPath) On Error Resume Next Set oSubFolder = fso.getfolder(parmPath) For Each oFile In oSubFolder.Files ' look in the current dir If Err.Number <> 0 Then ' if we get an error, just skip this entry Err.Clear ElseIf oFile.Name = FIL Then Set g = fso.GetFile(oFile) Set R = g.OpenAsTextStream(1,TristateUseDefault) Do While R.AtEndOfStream <> True myMsg = myMsg & R.ReadLine & vbcrlf 'File contents Loop myLocal = oFile.Path 'Tell us where the file is located Wscript.Echo myLocal & vbcrlf & vbcrlf & myMSG End If Next For Each oSubDir In oSubFolder.Subfolders DirWalk oSubDir.Path ' recurse the DirWalk sub with the subdir paths Next On Error Goto 0 ' Resume letting system handle errors. End Sub wscript.echo "Done searching" '--------------------------------------------------------------------------------------------------- Let us know if this works out for you or not. Country73
|
|
| |
|
|
|
| |
|
|
 |
|
 |
|
|