September 08 2010 07:58:47
Navigation
· Home
· Online Store
· Course Outlines (PDF Files)
· Sample Videos
· Contact Info
· Web Links
· Articles (Sample Code)

Other Videos
· WordPress (CMS)
· Joomla (CMS)
· Sharepoint

Other
· FAQ
· Search
Contribute to This Site
· Submit Link
· Get Benefitted Sites
No Competition
One of our so-called competitors offers under 6 hours of video training for a whopping $219 (choke, gasp, spew - you could hire a private tutor for that price). Did I mention that they ship their training on VHS tapes (remember those?). Check out our 'Course Outlines' link above. We offer a 2-days of training (15 hours) for $54 (2 CDs at $29 each). You watch our videos from a CD/ROM on your computer. We also include real-world lab/assignments in each course.
Articles: FSO / ReadLine
FSO / ReadLine
'==========================================================================
' NAME: FSO_File_ReadAll2.vbs 
' AUTHOR: Neal Walters 
' DATE  : 3/26/2005
' http://VBScript-Training.com 
'==========================================================================
Option Explicit 

   Dim fso, myFolderName, objFolder, myFileName, objFile, myFQFilename, objTextStream, fileContents
   
   Set fso = CreateObject("Scripting.FileSystemObject")
   
   Dim forReading, forWriting, forAppending 
   forReading = 1 
   forWriting = 2 
   forAppending = 8

   myFileName = "c:\Documents and Settings\nwalters\My Documents\Camtasia Studio\VBScript-Training2\FSO_Drive_Objects.txt" 
   
   Set objTextStream = fso.OpenTextFile(myFileName, forReading)
   fileContents =   objTextStream.ReadAll
   
   WScript.Echo fileContents
   
'==========================================================================
' NAME: FSO_File_ReadLineFilter.vbs 
' AUTHOR: Neal Walters 
' DATE  : 3/26/2005
' http://VBScript-Training.com 
'==========================================================================
Option Explicit 

   Dim fso, myFolderName, objFolder, myFileName, objTextStream, fileContents, currentLine, lineCounter 
   Dim BlankLineCounter, filter, wordPosition, linesFoundCounter, LinesNotFoundCounter 
   
   Set fso = CreateObject("Scripting.FileSystemObject")
   
   Dim forReading, forWriting, forAppending 
   forReading = 1 
   forWriting = 2 
   forAppending = 8

   myFileName = "c:\Documents and Settings\nwalters\My Documents\Camtasia Studio\VBScript-Training2\FSO_Drive_Objects.txt" 
   
   Set objTextStream = fso.OpenTextFile(myFileName, forReading)

'Read all at once method    
'    fileContents =   objTextStream.ReadAll
'    WScript.Echo fileContents

   filter = "read" 
   
    
   Do While Not objTextStream.AtEndOfStream 
     lineCounter = lineCounter + 1 
     currentLine = objTextStream.ReadLine 
     If currentLine = "" Then 
        BlankLineCounter = BlankLineCounter + 1 
     End If 
     
     wordPosition = InStr(ucase(currentLine), ucase(filter)) 
     If wordPosition > 0 Then 
        WScript.Echo "Line " & lineCounter & ": " & currentLine 
        linesFoundCounter = linesFoundCounter + 1 
     Else 
        LinesNotFoundCounter = LinesNotFoundCounter + 1 
     End If 
     
     
   Loop
   
   WScript.Echo VbCrLf & " This file contains " & BlankLineCounter & " blank lines out of a total of " & _ 
                         lineCounter & " lines." 
   WScript.Echo " This file contains the phrase: '" & filter & "' on " & _ 
                             linesFoundCounter & " lines. "                   
   WScript.Echo " And " & LinesNotFoundCounter & " lines do not contain this phrase."                               
Login
Username

Password



Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
Order Now - View Products


Default Shipping:
Phone: 214-403-6006
Our Sites
Software Training
XML-Online-Training.com
Biztalk-Training.com
SharePoint-Training.com
DotNet-AddOns-Training.com
CMSTrainingVideos.com

Language
LanguageLovers.com
Render time: 0.01 seconds 432,183 unique visits