+ Post New Thread
Page 1 of 3 123 LastLast
Results 1 to 15 of 39
Scripts Thread, vbscript to find a string value in a text file and then write an answer in Coding and Web Development; ...
  1. #1

    Join Date
    Feb 2011
    Posts
    37
    Thank Post
    2
    Thanked 1 Time in 1 Post
    Rep Power
    0

    vbscript to find a string value in a text file and then write an answer

    Hey all

    I have a vbscript that will read a folder directory and the files with each of the subfolders and then writes this to a txt file
    sample of txt file

    \\servername\packageinstalllogs$\AC-0012
    Adobe_Acrobat_9_Pro.txt

    \\servername\packageinstalllogs$\AC-0013
    Adobe_Acrobat_9_Pro.txt
    Adobe_Dreamweaver_CS5.txt
    Adobe_Fireworks_CS5.txt
    Adobe_Flash_CS5.txt
    Adobe_Photoshop_CS5.txt
    Mediator9.txt

    \\servername\packageinstalllogs$\AC-0014
    Adobe_Acrobat_9_Pro.txt
    Adobe_Dreamweaver_CS5.txt
    Adobe_Fireworks_CS5.txt
    Adobe_Flash_CS5.txt
    Adobe_Photoshop_CS5.txt
    Mediator9.txt

    What I need to add to the script is each txt file it finds I need it to open that file look for a script value if it finds it, it write as yes next to the file name if it does not find it, it writes a no.
    The above sample would then change to this

    \\servername\packageinstalllogs$\AC-0014
    Adobe_Acrobat_9_Pro.txt, Yes
    Adobe_Dreamweaver_CS5.txt, No
    Adobe_Fireworks_CS5.txt, Yes
    Adobe_Flash_CS5.txt, Yes
    Adobe_Photoshop_CS5.txt, Yes
    Mediator9.txt, Yes

    The script I have at the moment is as follows
    Dim FSO, LogFile

    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set FSO = CreateObject ("Scripting.FileSystemObject")

    objStartFolder = "\\servername\packageinstalllogs$"

    Set LogFile = FSO.CreateTextFile("\\servername\packageinstalllog s$\packageinstallcheck.txt",True)

    Set objFolder = objFSO.GetFolder(objStartFolder)

    LogFile.writeLine objFolder.Path

    Set colFiles = objFolder.Files
    For Each objFile in colFiles

    LogFile.writeLine objFile.Name

    Next
    LogFile.writeLine Echo

    ShowSubfolders objFSO.GetFolder(objStartFolder)

    Sub ShowSubFolders(Folder)
    For Each Subfolder in Folder.SubFolders

    LogFile.writeLine Subfolder.Path

    Set objFolder = objFSO.GetFolder(Subfolder.Path)
    Set colFiles = objFolder.Files
    For Each objFile in colFiles



    LogFile.writeLine objFile.Name
    Next
    LogFile.writeLine Echo
    ShowSubFolders Subfolder
    Next
    End Sub

    I have tried hitting the VBscript book off my head but it doesn’t seem to be working any help is appreciated

    Thank you

  2. #2

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,717
    Thank Post
    341
    Thanked 517 Times in 485 Posts
    Rep Power
    180
    Quote Originally Posted by NETKILLER View Post
    What I need to add to the script is each txt file it finds I need it to open that file look for a script value if it finds it, it write as yes next to the file name if it does not find it, it writes a no.
    What "script value" are you looking for?

    aka list all files, if .txt search inside, if found post yes, else no?

    Steve

  3. #3

    Join Date
    Feb 2011
    Posts
    37
    Thank Post
    2
    Thanked 1 Time in 1 Post
    Rep Power
    0
    Sorry it is meant to be string value not script value, anyway the value I am looking for

    Installation success or error status: 0.

    If that value is in a text file (normal the program name.txt) I want the script to write a line that combines the file name, yes if the vale is not there it writes the file name,no

  4. #4

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,717
    Thank Post
    341
    Thanked 517 Times in 485 Posts
    Rep Power
    180
    Will all these files be .txt and only have 1 line in them? Or do you need it to search through whole files, and determine what types etc it is? :P Reading one line of all .txts a lot easier than that

    Steve

  5. #5


    tom_newton's Avatar
    Join Date
    Sep 2006
    Location
    Leeds
    Posts
    4,484
    Thank Post
    867
    Thanked 853 Times in 674 Posts
    Rep Power
    197
    I bet you can get grep for windows. Then you can script this in batch file in about 5 min

  6. #6

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,717
    Thank Post
    341
    Thanked 517 Times in 485 Posts
    Rep Power
    180
    Quote Originally Posted by tom_newton View Post
    I bet you can get grep for windows. Then you can script this in batch file in about 5 min
    Think findstr still exists, but not sure if it's usable in vbs. Bat wise would be nice aye

    Steve

  7. #7

    Join Date
    Feb 2011
    Posts
    37
    Thank Post
    2
    Thanked 1 Time in 1 Post
    Rep Power
    0
    hey

    the text file is a msi output file so very full

    example


    === Logging started: 15/07/2011 12:30:25 ===
    Action start 12:30:25: INSTALL.
    Action start 12:30:25: AppSearch.
    Action ended 12:30:25: AppSearch. Return value 1.
    Action start 12:30:25: ValidateProductID.
    Action ended 12:30:25: ValidateProductID. Return value 1.
    Action start 12:30:25: CostInitialize.
    Action ended 12:30:25: CostInitialize. Return value 1.
    Action start 12:30:25: SetWINVOLUME.
    Action ended 12:30:25: SetWINVOLUME. Return value 1.
    Action start 12:30:25: FileCost.
    Action ended 12:30:25: FileCost. Return value 1.
    Action start 12:30:25: CostFinalize.
    Action ended 12:30:25: CostFinalize. Return value 1.
    Action start 12:30:25: InstallValidate.
    Action ended 12:30:25: InstallValidate. Return value 1.
    Action start 12:30:25: InstallInitialize.
    Action ended 12:30:25: InstallInitialize. Return value 1.
    Action start 12:30:25: ProcessComponents.
    Action ended 12:30:25: ProcessComponents. Return value 1.
    Action start 12:30:25: UnpublishFeatures.
    Action ended 12:30:25: UnpublishFeatures. Return value 1.
    Action start 12:30:25: StopServices.
    Action ended 12:30:25: StopServices. Return value 1.
    Action start 12:30:25: DeleteServices.
    Action ended 12:30:25: DeleteServices. Return value 1.
    Action start 12:30:25: RemoveRegistryValues.
    Action ended 12:30:25: RemoveRegistryValues. Return value 1.
    Action start 12:30:25: RemoveFiles.
    Action ended 12:30:25: RemoveFiles. Return value 0.
    Action start 12:30:25: InstallFiles.
    Action ended 12:30:25: InstallFiles. Return value 1.
    Action start 12:30:25: WriteRegistryValues.
    Action ended 12:30:25: WriteRegistryValues. Return value 1.
    Action start 12:30:25: StartServices.
    Action ended 12:30:25: StartServices. Return value 1.
    Action start 12:30:25: RegisterUser.
    Action ended 12:30:25: RegisterUser. Return value 1.
    Action start 12:30:25: RegisterProduct.
    Action ended 12:30:25: RegisterProduct. Return value 1.
    Action start 12:30:25: PublishFeatures.
    Action ended 12:30:25: PublishFeatures. Return value 1.
    Action start 12:30:25: PublishProduct.
    Action ended 12:30:25: PublishProduct. Return value 1.
    Action start 12:30:25: InstallFinalize.
    Action ended 12:30:32: InstallFinalize. Return value 1.
    Action ended 12:30:32: INSTALL. Return value 1.
    Property(S): COMMONAPPDATAFOLDER = C:\ProgramData
    Property(S): COMMONDESKTOPFOLDER = C:\Users\Public\Desktop
    Property(S): COMMONPROGRAMMENUFOLDER = C:\ProgramData\Microsoft\Windows\Start Menu\Programs
    Property(S): COMMONSTARTMENUFOLDER = C:\ProgramData\Microsoft\Windows\Start Menu
    Property(S): COMMONSTARTUPFOLDER = C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup
    Property(S): D_0 = C:\Windows\system32\Restore\
    Property(S): SystemFolder = C:\Windows\system32\
    Property(S): D_1 = C:\Windows\Microsoft.NET\DirectX for Managed Code\1.0.2911.0\
    Property(S): D_2 = C:\Windows\Microsoft.NET\DirectX for Managed Code\1.0.2910.0\
    Property(S): D_3 = C:\Windows\Microsoft.NET\DirectX for Managed Code\1.0.2909.0\
    Property(S): D_4 = C:\Windows\Microsoft.NET\DirectX for Managed Code\1.0.2908.0\
    Property(S): D_5 = C:\Windows\Microsoft.NET\DirectX for Managed Code\1.0.2907.0\
    Property(S): D_6 = C:\Windows\Microsoft.NET\DirectX for Managed Code\1.0.2906.0\
    Property(S): D_7 = C:\Windows\Microsoft.NET\DirectX for Managed Code\1.0.2905.0\
    Property(S): D_8 = C:\Windows\Microsoft.NET\DirectX for Managed Code\1.0.2904.0\
    Property(S): D_9 = C:\Windows\Microsoft.NET\DirectX for Managed Code\1.0.2903.0\
    Property(S): D_10 = C:\Windows\Microsoft.NET\DirectX for Managed Code\1.0.2902.0\
    Property(S): D_13 = C:\Windows\Logs\
    Property(S): D_14 = C:\Windows\assembly\GAC\Microsoft.DirectX.DirectSo und\1.0.2902.0__31bf3856ad364e35\
    Property(S): D_16 = C:\Windows\assembly\GAC\Microsoft.DirectX.DirectPl ay\1.0.2902.0__31bf3856ad364e35\
    Property(S): D_18 = C:\Windows\assembly\GAC\Microsoft.DirectX.DirectIn put\1.0.2902.0__31bf3856ad364e35\
    Property(S): D_20 = C:\Windows\assembly\GAC\Microsoft.DirectX.DirectDr aw\1.0.2902.0__31bf3856ad364e35\
    Property(S): D_22 = C:\Windows\assembly\GAC\Microsoft.DirectX.Direct3D X\1.0.2911.0__31bf3856ad364e35\
    Property(S): D_23 = C:\Windows\assembly\GAC\Microsoft.DirectX.Direct3D X\1.0.2910.0__31bf3856ad364e35\
    Property(S): D_24 = C:\Windows\assembly\GAC\Microsoft.DirectX.Direct3D X\1.0.2909.0__31bf3856ad364e35\
    Property(S): D_25 = C:\Windows\assembly\GAC\Microsoft.DirectX.Direct3D X\1.0.2908.0__31bf3856ad364e35\
    Property(S): D_26 = C:\Windows\assembly\GAC\Microsoft.DirectX.Direct3D X\1.0.2907.0__31bf3856ad364e35\
    Property(S): D_27 = C:\Windows\assembly\GAC\Microsoft.DirectX.Direct3D X\1.0.2906.0__31bf3856ad364e35\
    Property(S): D_28 = C:\Windows\assembly\GAC\Microsoft.DirectX.Direct3D X\1.0.2905.0__31bf3856ad364e35\
    Property(S): D_29 = C:\Windows\assembly\GAC\Microsoft.DirectX.Direct3D X\1.0.2904.0__31bf3856ad364e35\
    Property(S): D_30 = C:\Windows\assembly\GAC\Microsoft.DirectX.Direct3D X\1.0.2903.0__31bf3856ad364e35\
    Property(S): D_31 = C:\Windows\assembly\GAC\Microsoft.DirectX.Direct3D X\1.0.2902.0__31bf3856ad364e35\
    Property(S): D_33 = C:\Windows\assembly\GAC\Microsoft.DirectX.Direct3D \1.0.2902.0__31bf3856ad364e35\
    Property(S): D_35 = C:\Windows\assembly\GAC\Microsoft.DirectX.Diagnost ics\1.0.2902.0__31bf3856ad364e35\
    Property(S): D_37 = C:\Windows\assembly\GAC\Microsoft.DirectX.AudioVid eoPlayback\1.0.2902.0__31bf3856ad364e35\
    Property(S): D_39 = C:\Windows\assembly\GAC\Microsoft.DirectX\1.0.2902 .0__31bf3856ad364e35\
    Property(S): D_43 = C:\Windows\INF\
    Property(S): D_44 = C:\System Volume Information\SPP\OnlineMetadataCache\
    Property(S): TARGETDIR = C:\
    Property(S): WINVOLUME = C:\
    Property(S): D_11 = C:\Windows\Microsoft.NET\DirectX for Managed Code\
    Property(S): D_12 = C:\Windows\Microsoft.NET\
    Property(S): WindowsFolder = C:\Windows\
    Property(S): D_15 = C:\Windows\assembly\GAC\Microsoft.DirectX.DirectSo und\
    Property(S): D_41 = C:\Windows\assembly\GAC\
    Property(S): D_17 = C:\Windows\assembly\GAC\Microsoft.DirectX.DirectPl ay\
    Property(S): D_19 = C:\Windows\assembly\GAC\Microsoft.DirectX.DirectIn put\
    Property(S): D_21 = C:\Windows\assembly\GAC\Microsoft.DirectX.DirectDr aw\
    Property(S): D_32 = C:\Windows\assembly\GAC\Microsoft.DirectX.Direct3D X\
    Property(S): D_34 = C:\Windows\assembly\GAC\Microsoft.DirectX.Direct3D \
    Property(S): D_36 = C:\Windows\assembly\GAC\Microsoft.DirectX.Diagnost ics\
    Property(S): D_38 = C:\Windows\assembly\GAC\Microsoft.DirectX.AudioVid eoPlayback\
    Property(S): D_40 = C:\Windows\assembly\GAC\Microsoft.DirectX\
    Property(S): D_42 = C:\Windows\assembly\
    Property(S): D_45 = C:\System Volume Information\SPP\
    Property(S): D_46 = C:\System Volume Information\
    Property(S): SourceDir = \\server\packages$\DirectXfeb2010\
    Property(S): VersionNT = 601
    Property(S): Manufacturer = Microsoft
    Property(S): ProductCode = {0EC85D7E-883F-4E35-99AB-FB71FAD96F9E}
    Property(S): ProductLanguage = 2057
    Property(S): ProductName = DirectXfeb2010
    Property(S): ProductVersion = 1.0.0.0
    Property(S): UpgradeCode = {CEE9DF8F-0D39-4A31-A63E-6ECBC3E1D926}
    Property(S): ARPNOMODIFY = NoModify
    Property(S): REINSTALLMODE = omus
    Property(S): ALLUSERS = 1
    Property(S): ARPPRODUCTICON = MainIcon
    Property(S): MsiLogFileLocation = \\server\packageinstalllogs$\VMC-0002\DirectXfeb2010.txt
    Property(S): PackageCode = {AC01DC90-60FA-4895-AE2A-5EB6E7E6A13A}
    Property(S): ProductState = -1
    Property(S): PackagecodeChanging = 1
    Property(S): CURRENTDIRECTORY = C:\Windows\system32
    Property(S): CLIENTUILEVEL = 3
    Property(S): CLIENTPROCESSID = 1928
    Property(S): VersionDatabase = 200
    Property(S): VersionMsi = 5.00
    Property(S): WindowsBuild = 7600
    Property(S): ServicePackLevel = 0
    Property(S): ServicePackLevelMinor = 0
    Property(S): MsiNTProductType = 1
    Property(S): WindowsVolume = C:\
    Property(S): System16Folder = C:\Windows\system\
    Property(S): RemoteAdminTS = 1
    Property(S): TempFolder = C:\Users\internet\AppData\Local\Temp\
    Property(S): ProgramFilesFolder = C:\Program Files\
    Property(S): CommonFilesFolder = C:\Program Files\Common Files\
    Property(S): AppDataFolder = C:\Users\internet\AppData\Roaming\
    Property(S): FavoritesFolder = C:\Users\internet\Favorites\
    Property(S): NetHoodFolder = C:\Users\internet\AppData\Roaming\Microsoft\Window s\Network Shortcuts\
    Property(S): PersonalFolder = C:\Users\internet\Documents\
    Property(S): PrintHoodFolder = C:\Users\internet\AppData\Roaming\Microsoft\Window s\Printer Shortcuts\
    Property(S): RecentFolder = C:\Users\internet\AppData\Roaming\Microsoft\Window s\Recent\
    Property(S): SendToFolder = C:\Users\internet\AppData\Roaming\Microsoft\Window s\SendTo\
    Property(S): TemplateFolder = C:\ProgramData\Microsoft\Windows\Templates\
    Property(S): CommonAppDataFolder = C:\ProgramData\
    Property(S): LocalAppDataFolder = C:\Users\internet\AppData\Local\
    Property(S): MyPicturesFolder = C:\Users\internet\Pictures\
    Property(S): AdminToolsFolder = C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Administrative Tools\
    Property(S): StartupFolder = C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\
    Property(S): ProgramMenuFolder = C:\ProgramData\Microsoft\Windows\Start Menu\Programs\
    Property(S): StartMenuFolder = C:\ProgramData\Microsoft\Windows\Start Menu\
    Property(S): DesktopFolder = C:\Users\Public\Desktop\
    Property(S): FontsFolder = C:\Windows\Fonts\
    Property(S): GPTSupport = 1
    Property(S): OLEAdvtSupport = 1
    Property(S): ShellAdvtSupport = 1
    Property(S): Intel = 6
    Property(S): PhysicalMemory = 1024
    Property(S): VirtualMemory = 1608
    Property(S): AdminUser = 1
    Property(S): MsiTrueAdminUser = 1
    Property(S): LogonUser = internet
    Property(S): UserSID = S-1-5-21-585913135-526007781-3860785735-5362
    Property(S): UserLanguageID = 2057
    Property(S): ComputerName = VMC-0002
    Property(S): SystemLanguageID = 2057
    Property(S): ScreenX = 1024
    Property(S): ScreenY = 768
    Property(S): CaptionHeight = 22
    Property(S): BorderTop = 1
    Property(S): BorderSide = 1
    Property(S): TextHeight = 16
    Property(S): TextInternalLeading = 3
    Property(S): ColorBits = 32
    Property(S): TTCSupport = 1
    Property(S): Time = 12:30:32
    Property(S): Date = 15/07/2011
    Property(S): MsiNetAssemblySupport = 2.0.50727.4927
    Property(S): MsiWin32AssemblySupport = 6.1.7600.16385
    Property(S): RedirectedDllSupport = 2
    Property(S): MsiRunningElevated = 1
    Property(S): Privileged = 1
    Property(S): USERNAME = Network Manager
    Property(S): COMPANYNAME = Park Hall Academy
    Property(S): DATABASE = C:\Windows\Installer\869ef3.msi
    Property(S): OriginalDatabase = \\server\packages$\DirectXfeb2010\DirectXfeb2010.m si
    Property(S): UILevel = 2
    Property(S): ACTION = INSTALL
    Property(S): ROOTDRIVE = C:\
    Property(S): CostingComplete = 1
    Property(S): OutOfDiskSpace = 0
    Property(S): OutOfNoRbDiskSpace = 0
    Property(S): PrimaryVolumeSpaceAvailable = 0
    Property(S): PrimaryVolumeSpaceRequired = 0
    Property(S): PrimaryVolumeSpaceRemaining = 0
    Property(S): INSTALLLEVEL = 1
    Property(S): SOURCEDIR = \\server\packages$\DirectXfeb2010\
    Property(S): SourcedirProduct = {0EC85D7E-883F-4E35-99AB-FB71FAD96F9E}
    Property(S): ProductToBeRegistered = 1
    MSI (s) (F8:04) [12:30:32:181]: Product: DirectXfeb2010 -- Installation completed successfully.

    MSI (s) (F8:04) [12:30:32:196]: Windows Installer installed the product. Product Name: DirectXfeb2010. Product Version: 1.0.0.0. Product Language: 2057. Manufacturer: Microsoft. Installation success or error status: 0.

    === Logging stopped: 15/07/2011 12:30:32 ===

  8. #8

    LosOjos's Avatar
    Join Date
    Dec 2009
    Location
    West Midlands
    Posts
    5,559
    Thank Post
    1,469
    Thanked 1,219 Times in 828 Posts
    Rep Power
    752
    This script should do it I think:

    Code:
    Dim FSO, LogFile, rdFile
    
    Set FSO = CreateObject ("Scripting.FileSystemObject")
    
    objStartFolder = "\\servername\packageinstalllogs$"
    
    Set LogFile = FSO.CreateTextFile("\\servername\packageinstalllog s$\packageinstallcheck.txt",True)
    Set objFolder = FSO.GetFolder(objStartFolder)
    
    LogFile.writeLine objFolder.Path
    
    Set colFiles = objFolder.Files
    For Each objFile in colFiles
    	LogFile.writeLine objFile.Name
    Next
    
    LogFile.writeLine Echo
    
    ShowSubfolders FSO.GetFolder(objStartFolder)
    
    
    Sub ShowSubFolders(Folder)
    	For Each Subfolder in Folder.SubFolders
    		LogFile.writeLine Subfolder.Path
    		
    		Set objFolder = FSO.GetFolder(Subfolder.Path)
    		Set colFiles = objFolder.Files
    		
    		For Each objFile in colFiles
    			LogFile.Write objFile.Name
    			
    			Set rdFile = FSO.OpenTextFile(objFile.Path, 1)
    			strContents = rdFile.ReadAll
    			rdFile.Close
    			
    			if InStr(1, strContents, "Installation success or error status: 0", 1) > 0 Then 
    				LogFile.Write ", Yes" & Chr(10)
    			else
    				LogFile.Write ", No" & Chr(10)
    			end if
    		Next
    		
    		LogFile.writeLine Echo
    		ShowSubFolders Subfolder
    	Next
    End Sub

  9. #9

    Join Date
    Feb 2011
    Posts
    37
    Thank Post
    2
    Thanked 1 Time in 1 Post
    Rep Power
    0
    Hey
    Very close. I have to tweak it to display how I want it to, but it only displays “no” at the end of each Line
    Sample
    \\server\packageinstalllogs$\VMC-0002
    DirectXfeb2010.txt, No
    eset_client.txt, No
    Mediator9.txt, No
    Microsoft_DOTNET4-MSI_netfx_Core_x86.msi.txt, No
    Microsoft_DOTNET4-MSI_netfx_Extended_x86.msi.txt, No
    Microsoft_DOTNET4.htm, No
    Microsoft_Silverlight.txt, No
    Microsoft_Silverlight_update.txt, No
    MindGenius.txt, No
    Scorch_plugin.txt, No
    Securus_Client_v7.00.20_v11.txt, No

    I have had a look at the files and the string value is there

    Also the changes I have made are below
    For Each objFile in colFiles
      
                Set rdFile = FSO.OpenTextFile(objFile. Path, 1)
                strContents = rdFile.ReadAll
                rdFile.Close
                
                if InStr(1, strContents, "success or e rror status: 0.", 1) > 0 Then 
                    LogFile.Write objFile.Name & ", Ye s" & Chr(10)
                    LogFile.writeLine Echo
                else
                    LogFile.Write objFile.Name & ", No " & Chr(10)
                    LogFile.writeLine Echo
                end if
            Next

  10. #10

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,717
    Thank Post
    341
    Thanked 517 Times in 485 Posts
    Rep Power
    180
    Try changing:

    Code:
    if InStr(1, strContents, "Installation success or error status: 0", 1) > 0 Then
    to

    Code:
    if InStr(strContents, "Installation success or error status: 0") > 0 Then
    Steve

  11. #11

    Join Date
    Feb 2011
    Posts
    37
    Thank Post
    2
    Thanked 1 Time in 1 Post
    Rep Power
    0
    nope that did not work still saying no

  12. #12

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,717
    Thank Post
    341
    Thanked 517 Times in 485 Posts
    Rep Power
    180
    Might be worth doing a WScript.Echo strContents 

    just before it does the check, as I thought there was a limit to how much a string could hold at once, it may be as silly as it's cutting off the end of the file.

    Easy way to check it

    Steve

  13. #13

    LosOjos's Avatar
    Join Date
    Dec 2009
    Location
    West Midlands
    Posts
    5,559
    Thank Post
    1,469
    Thanked 1,219 Times in 828 Posts
    Rep Power
    752
    I'm afraid I'm at a loss as to why, it works fine for me...

    Perhaps it could be a permissions issue blocking the script from accessing the files' contents, although I would expect you to get an error message if that were the case...

  14. #14

    Join Date
    Feb 2011
    Posts
    37
    Thank Post
    2
    Thanked 1 Time in 1 Post
    Rep Power
    0
    Hey

    your right it does help see below

    vbserror.gif

  15. #15

    LosOjos's Avatar
    Join Date
    Dec 2009
    Location
    West Midlands
    Posts
    5,559
    Thank Post
    1,469
    Thanked 1,219 Times in 828 Posts
    Rep Power
    752
    @Steve21 might be on to something, try this to read files line by line (just replace the necessary code in ShowSubFolders):

    Code:
    For Each objFile in colFiles
    	LogFile.Write objFile.Name
    		
    	Set rdFile = FSO.OpenTextFile(objFile.Path, 1)
    	bFound = False
    	Do Until rdFile.AtEndOfStream
    		srtContents = rdFile.ReadLine
    		if InStr(1, strContents, "success or error status: 0", 1) > 0 Then 
    			bFound = True
    			Exit Do
                    End If
    	Loop
    	rdFile.Close
    	
    	if bFound = True Then 
    		LogFile.Write ", Yes" & Chr(10)
    		LogFile.WriteLine Echo
    	else
    		LogFile.Write ", No" & Chr(10)
    		LogFile.WriteLine Echo
    	end if
    Next
    Last edited by LosOjos; 20th July 2011 at 10:43 AM. Reason: missed an "End If"! :doh:

SHARE:
+ Post New Thread
Page 1 of 3 123 LastLast

Similar Threads

  1. Replies: 8
    Last Post: 5th August 2010, 10:04 AM
  2. List computers in Domain in a text file with vbs
    By FatBoy in forum How do you do....it?
    Replies: 5
    Last Post: 15th February 2010, 12:29 PM
  3. Replies: 7
    Last Post: 29th September 2009, 06:04 PM
  4. Where do I look to find a job in a school in London area?
    By alena in forum Educational IT Jobs
    Replies: 2
    Last Post: 26th February 2008, 01:21 PM
  5. How to find Command Bar ID's in Office 2003
    By originofsymmetry in forum How do you do....it?
    Replies: 1
    Last Post: 15th July 2007, 10:41 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •