Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Nifty line counter needed

Reply
 
Old 08-05-2008   #1 (permalink)
prebble


 
 

Nifty line counter needed

Hi,
I hope someone can help as I need a vbscript in a hurry.


I have a number of text files in a specific folder.
I need to count the number of lines
in each text file in that folder and
create an output file with the name of the text file
and the number of lines.

Then sort the output file in alphabetical order of the text file names.

I know how to count lines in any specific file but
I'm not so good with the "for each file in this folder" business.


Here's what I did with for counting lines.
Most of it is probably copied from somewhere.
--------
'Create a File System Object
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFileContents = Nothing

Dim InputFile
InputFile = InputBox("Nom du fichier")

'Get the file contents
Dim MyFileContents
Set MyFileContents = fso.OpenTextFile(InputFile)

'Loop through counting the lines
'
Do While Not MyFileContents.AtEndOfStream
s= MyFileContents.ReadLIne

linelength = len(S)

if linelength < 10 then
msgbox ctr
end if
'msgbox "x" & x & vbcrlf &_
' "linelength " & linelength & vbcrlf
if x <= linelength then
x = linelength
end if
ctr = ctr + 1
Loop

'Return the file's line count


msgbox "File name " & InputFile & vbcrlf &_
"FileLineCount " & Ctr & vbcrlf &_
"Maximum Line length " & x

'Cleanup
MyFileContents.Close
Set MyFileContents = Nothing
Set fso = Nothing
--------
TIA
prebble





My System SpecsSystem Spec
Old 08-05-2008   #2 (permalink)
mayayana


 
 

Re: Nifty line counter needed

There's nothing wrong with the ReadLine method.
(It's not clear what all that "x" code is about.)
Personally it seems easier to me (and maybe
a bit quicker) to just do:

Set FileContents = fso.OpenTextFile(InputFile, 1)
s = FileContents.ReadAll
FileContents.close
Set FileContents = Nothing

A = Split(s, vbCrLf)
LineCount = UBound(A) + 1

'-- You'll need error trapping for blank files and may
want to make other minor adjustments for things like
multiple vbCrLf that may appear at end of files.

For multiple files you'll probably want to put
your counter code into a function. Then do something
like:

-----------------------------------------

Set oFol = FSO.GetFolder("folderpath")
Set oFils = oFol.Files
For Each oFil in oFils
LineCount = GetLineCount(oFil.Path)
'-- maintain a list of files and lengths:
sList = sList & oFil.Path & "Linecount: " & LineCount & vbCrLf
Next
Set oFils = Nothing
Set oFol = Nothing

Function GetLineCount(FilePath)
Dim TS, s, A
On Error Resume Next
Set TS = fso.OpenTextFile(FilePath, 1)
s = TS.ReadAll
TS.close
Set TS = Nothing

A = Split(s, vbCrLf)
GetLineCount = UBound(A) + 1
End Function

'-- At this point you have a string/list of file paths
and their line counts that you can just write to disk.

Quote:

> I hope someone can help as I need a vbscript in a hurry.
>
>
> I have a number of text files in a specific folder.
> I need to count the number of lines
> in each text file in that folder and
> create an output file with the name of the text file
> and the number of lines.
>
> Then sort the output file in alphabetical order of the text file names.
>
> I know how to count lines in any specific file but
> I'm not so good with the "for each file in this folder" business.
>
>
> Here's what I did with for counting lines.
> Most of it is probably copied from somewhere.
> --------
> 'Create a File System Object
> Dim fso
> Set fso = CreateObject("Scripting.FileSystemObject")
> Set MyFileContents = Nothing
>
> Dim InputFile
> InputFile = InputBox("Nom du fichier")
>
> 'Get the file contents
> Dim MyFileContents
> Set MyFileContents = fso.OpenTextFile(InputFile)
>
> 'Loop through counting the lines
> '
> Do While Not MyFileContents.AtEndOfStream
> s= MyFileContents.ReadLIne
>
> linelength = len(S)
>
> if linelength < 10 then
> msgbox ctr
> end if
> 'msgbox "x" & x & vbcrlf &_
> ' "linelength " & linelength & vbcrlf
> if x <= linelength then
> x = linelength
> end if
> ctr = ctr + 1
> Loop
>
> 'Return the file's line count
>
>
> msgbox "File name " & InputFile & vbcrlf &_
> "FileLineCount " & Ctr & vbcrlf &_
> "Maximum Line length " & x
>
> 'Cleanup
> MyFileContents.Close
> Set MyFileContents = Nothing
> Set fso = Nothing
> --------
> TIA
> prebble
>
>
>
>

My System SpecsSystem Spec
Old 08-05-2008   #3 (permalink)
Tom Lavedas


 
 

Re: Nifty line counter needed

On Aug 5, 10:23 am, "mayayana" <mayaXXy...@xxxxxx> wrote:
Quote:

> There's nothing wrong with the ReadLine method.
> (It's not clear what all that "x" code is about.)
> Personally it seems easier to me (and maybe
> a bit quicker) to just do:
>
> Set FileContents = fso.OpenTextFile(InputFile, 1)
> s = FileContents.ReadAll
> FileContents.close
> Set FileContents = Nothing
>
> A = Split(s, vbCrLf)
> LineCount = UBound(A) + 1
>
> '-- You'll need error trapping for blank files and may
> want to make other minor adjustments for things like
> multiple vbCrLf that may appear at end of files.
>
> For multiple files you'll probably want to put
> your counter code into a function. Then do something
> like:
>
> -----------------------------------------
>
> Set oFol = FSO.GetFolder("folderpath")
> Set oFils = oFol.Files
> For Each oFil in oFils
> LineCount = GetLineCount(oFil.Path)
> '-- maintain a list of files and lengths:
> sList = sList & oFil.Path & "Linecount: " & LineCount & vbCrLf
> Next
> Set oFils = Nothing
> Set oFol = Nothing
>
> Function GetLineCount(FilePath)
> Dim TS, s, A
> On Error Resume Next
> Set TS = fso.OpenTextFile(FilePath, 1)
> s = TS.ReadAll
> TS.close
> Set TS = Nothing
>
> A = Split(s, vbCrLf)
> GetLineCount = UBound(A) + 1
> End Function
>
> '-- At this point you have a string/list of file paths
> and their line counts that you can just write to disk.
>
Quote:

> > I hope someone can help as I need a vbscript in a hurry.
>
Quote:

> > I have a number of text files in a specific folder.
> > I need to count the number of lines
> > in each text file in that folder and
> > create an output file with the name of the text file
> > and the number of lines.
>
Quote:

> > Then sort the output file in alphabetical order of the text file names.
>
Quote:

> > I know how to count lines in any specific file but
> > I'm not so good with the "for each file in this folder" business.
>
Quote:

> > Here's what I did with for counting lines.
> > Most of it is probably copied from somewhere.
> > --------
> > 'Create a File System Object
> > Dim fso
> > Set fso = CreateObject("Scripting.FileSystemObject")
> > Set MyFileContents = Nothing
>
Quote:

> > Dim InputFile
> > InputFile = InputBox("Nom du fichier")
>
Quote:

> > 'Get the file contents
> > Dim MyFileContents
> > Set MyFileContents = fso.OpenTextFile(InputFile)
>
Quote:

> > 'Loop through counting the lines
> > '
> > Do While Not MyFileContents.AtEndOfStream
> > s= MyFileContents.ReadLIne
>
Quote:

> > linelength = len(S)
>
Quote:

> > if linelength < 10 then
> > msgbox ctr
> > end if
> > 'msgbox "x" & x & vbcrlf &_
> > ' "linelength " & linelength & vbcrlf
> > if x <= linelength then
> > x = linelength
> > end if
> > ctr = ctr + 1
> > Loop
>
Quote:

> > 'Return the file's line count
>
Quote:

> > msgbox "File name " & InputFile & vbcrlf &_
> > "FileLineCount " & Ctr & vbcrlf &_
> > "Maximum Line length " & x
>
Quote:

> > 'Cleanup
> > MyFileContents.Close
> > Set MyFileContents = Nothing
> > Set fso = Nothing
> > --------
> > TIA
> > prebble
Here is my contestant for the quickest/simplest file line counter ...

Function LineCount(sFilespec)
Const ForAppending = 8
with CreateObject("Scripting.FileSystemObject")
LineCount = .OpenTextFile(sFilespec, ForAppending).Line
end with
end Function

I posted an example based on this technique a few days ago. And as I
recall, someone else showed it to me a few years back. I am told that
it is off by one count for empty files and files full of blank lines
(new line characters only - no other text).

Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/
My System SpecsSystem Spec
Old 08-05-2008   #4 (permalink)
Paul Randall


 
 

Re: Nifty line counter needed


"Tom Lavedas" <tglbatch@xxxxxx> wrote in message
news:360fd3ac-76f8-45cc-ac08-4670445e4cf0@xxxxxx
Quote:

> On Aug 5, 10:23 am, "mayayana" <mayaXXy...@xxxxxx> wrote:
Quote:

>> There's nothing wrong with the ReadLine method.
>> (It's not clear what all that "x" code is about.)
>> Personally it seems easier to me (and maybe
>> a bit quicker) to just do:
>>
>> Set FileContents = fso.OpenTextFile(InputFile, 1)
>> s = FileContents.ReadAll
>> FileContents.close
>> Set FileContents = Nothing
>>
>> A = Split(s, vbCrLf)
>> LineCount = UBound(A) + 1
>>
>> '-- You'll need error trapping for blank files and may
>> want to make other minor adjustments for things like
>> multiple vbCrLf that may appear at end of files.
>>
>> For multiple files you'll probably want to put
>> your counter code into a function. Then do something
>> like:
>>
>> -----------------------------------------
>>
>> Set oFol = FSO.GetFolder("folderpath")
>> Set oFils = oFol.Files
>> For Each oFil in oFils
>> LineCount = GetLineCount(oFil.Path)
>> '-- maintain a list of files and lengths:
>> sList = sList & oFil.Path & "Linecount: " & LineCount & vbCrLf
>> Next
>> Set oFils = Nothing
>> Set oFol = Nothing
>>
>> Function GetLineCount(FilePath)
>> Dim TS, s, A
>> On Error Resume Next
>> Set TS = fso.OpenTextFile(FilePath, 1)
>> s = TS.ReadAll
>> TS.close
>> Set TS = Nothing
>>
>> A = Split(s, vbCrLf)
>> GetLineCount = UBound(A) + 1
>> End Function
>>
>> '-- At this point you have a string/list of file paths
>> and their line counts that you can just write to disk.
>>
Quote:

>> > I hope someone can help as I need a vbscript in a hurry.
>>
Quote:

>> > I have a number of text files in a specific folder.
>> > I need to count the number of lines
>> > in each text file in that folder and
>> > create an output file with the name of the text file
>> > and the number of lines.
>>
Quote:

>> > Then sort the output file in alphabetical order of the text file names.
>>
Quote:

>> > I know how to count lines in any specific file but
>> > I'm not so good with the "for each file in this folder" business.
>>
Quote:

>> > Here's what I did with for counting lines.
>> > Most of it is probably copied from somewhere.
>> > --------
>> > 'Create a File System Object
>> > Dim fso
>> > Set fso = CreateObject("Scripting.FileSystemObject")
>> > Set MyFileContents = Nothing
>>
Quote:

>> > Dim InputFile
>> > InputFile = InputBox("Nom du fichier")
>>
Quote:

>> > 'Get the file contents
>> > Dim MyFileContents
>> > Set MyFileContents = fso.OpenTextFile(InputFile)
>>
Quote:

>> > 'Loop through counting the lines
>> > '
>> > Do While Not MyFileContents.AtEndOfStream
>> > s= MyFileContents.ReadLIne
>>
Quote:

>> > linelength = len(S)
>>
Quote:

>> > if linelength < 10 then
>> > msgbox ctr
>> > end if
>> > 'msgbox "x" & x & vbcrlf &_
>> > ' "linelength " & linelength & vbcrlf
>> > if x <= linelength then
>> > x = linelength
>> > end if
>> > ctr = ctr + 1
>> > Loop
>>
Quote:

>> > 'Return the file's line count
>>
Quote:

>> > msgbox "File name " & InputFile & vbcrlf &_
>> > "FileLineCount " & Ctr & vbcrlf &_
>> > "Maximum Line length " & x
>>
Quote:

>> > 'Cleanup
>> > MyFileContents.Close
>> > Set MyFileContents = Nothing
>> > Set fso = Nothing
>> > --------
>> > TIA
>> > prebble
>
> Here is my contestant for the quickest/simplest file line counter ...
>
> Function LineCount(sFilespec)
> Const ForAppending = 8
> with CreateObject("Scripting.FileSystemObject")
> LineCount = .OpenTextFile(sFilespec, ForAppending).Line
> end with
> end Function
>
> I posted an example based on this technique a few days ago. And as I
> recall, someone else showed it to me a few years back. I am told that
> it is off by one count for empty files and files full of blank lines
> (new line characters only - no other text).
As with most things in life, perhaps we need to define what a line is (for
counting purposes) before we can count them. If a file can contain more
than one empty line, then an empty file must contain one empty line. And
perhaps the definition of a line separator is necessary, such as vbLf. With
these definitions, the following script shows that your function produces
correct results; the script is attached also to avoid line wrap problems:

Option Explicit
MsgBox "started in " & vbCrLf & _
WScript.CreateObject("WScript.Shell").CurrentDirectory

fOverWrite "dummy.txt", ""
MsgBox "Line count for empty file -- should be one (for one empty line): " &
LineCount("dummy.txt")
fOverWrite "dummy.txt", vbCrLf
MsgBox "Line count for CrLf file -- should be two (for two empty lines): " &
LineCount("dummy.txt")
fOverWrite "dummy.txt", "Now is the time for all ..."
MsgBox "Line count for one-line file -- should be one: " &
LineCount("dummy.txt")
fOverWrite "dummy.txt", "Now is the" & vbCrLf & " time for all ..."
MsgBox "Line count for two-line file -- should be two: " &
LineCount("dummy.txt")
fOverWrite "dummy.txt", "Now is the" & vbCrLf & vbCr & " time for all ..."
MsgBox "Line count for two-line file -- should be two: " &
LineCount("dummy.txt")
fOverWrite "dummy.txt", "Now is the" & vbCrLf & vbLf & " time for all ..."
MsgBox "Line count for three-line file -- should be three: " &
LineCount("dummy.txt")

Function LineCount(sFilespec)
Const ForAppending = 8
with CreateObject("Scripting.FileSystemObject")
LineCount = .OpenTextFile(sFilespec, ForAppending).Line
end with
end Function

Sub fOverWrite(FilePath, sData)
'Try writing ASCII file.
'If error occurs, try writing Unicode file
Dim objFSO 'Global file system object
Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim oTS
Set oTS = objFSO.OpenTextFile(FilePath, 2, true)
On Error Resume Next
oTS.Write sData
If Err then
On Error GoTo 0
oTS.close
Set oTS = objFSO.OpenTextFile(FilePath, 2, true, -1)
On Error Resume Next
oTS.Write sData
If Err Then
msgbox "Error in fOverWrite - tried ANSI and Unicode" & vbcrlf & _
"FilePath = " & FilePath & vbcrlf & _
"sData = " & sData
wscript.quit
End If
End If
On Error GoTo 0
oTS.Close
End Sub

-Paul Randall




My System SpecsSystem Spec
Old 08-05-2008   #5 (permalink)
soler


 
 

Re: Nifty line counter needed

try
find /c /v "" filenamehere.txt

ouput will be:
---------- filenamehere.txt: 138
--
soler


"Paul Randall" wrote:
Quote:

>
> "Tom Lavedas" <tglbatch@xxxxxx> wrote in message
> news:360fd3ac-76f8-45cc-ac08-4670445e4cf0@xxxxxx
Quote:

> > On Aug 5, 10:23 am, "mayayana" <mayaXXy...@xxxxxx> wrote:
Quote:

> >> There's nothing wrong with the ReadLine method.
> >> (It's not clear what all that "x" code is about.)
> >> Personally it seems easier to me (and maybe
> >> a bit quicker) to just do:
> >>
> >> Set FileContents = fso.OpenTextFile(InputFile, 1)
> >> s = FileContents.ReadAll
> >> FileContents.close
> >> Set FileContents = Nothing
> >>
> >> A = Split(s, vbCrLf)
> >> LineCount = UBound(A) + 1
> >>
> >> '-- You'll need error trapping for blank files and may
> >> want to make other minor adjustments for things like
> >> multiple vbCrLf that may appear at end of files.
> >>
> >> For multiple files you'll probably want to put
> >> your counter code into a function. Then do something
> >> like:
> >>
> >> -----------------------------------------
> >>
> >> Set oFol = FSO.GetFolder("folderpath")
> >> Set oFils = oFol.Files
> >> For Each oFil in oFils
> >> LineCount = GetLineCount(oFil.Path)
> >> '-- maintain a list of files and lengths:
> >> sList = sList & oFil.Path & "Linecount: " & LineCount & vbCrLf
> >> Next
> >> Set oFils = Nothing
> >> Set oFol = Nothing
> >>
> >> Function GetLineCount(FilePath)
> >> Dim TS, s, A
> >> On Error Resume Next
> >> Set TS = fso.OpenTextFile(FilePath, 1)
> >> s = TS.ReadAll
> >> TS.close
> >> Set TS = Nothing
> >>
> >> A = Split(s, vbCrLf)
> >> GetLineCount = UBound(A) + 1
> >> End Function
> >>
> >> '-- At this point you have a string/list of file paths
> >> and their line counts that you can just write to disk.
> >>
> >> > I hope someone can help as I need a vbscript in a hurry.
> >>
> >> > I have a number of text files in a specific folder.
> >> > I need to count the number of lines
> >> > in each text file in that folder and
> >> > create an output file with the name of the text file
> >> > and the number of lines.
> >>
> >> > Then sort the output file in alphabetical order of the text file names.
> >>
> >> > I know how to count lines in any specific file but
> >> > I'm not so good with the "for each file in this folder" business.
> >>
> >> > Here's what I did with for counting lines.
> >> > Most of it is probably copied from somewhere.
> >> > --------
> >> > 'Create a File System Object
> >> > Dim fso
> >> > Set fso = CreateObject("Scripting.FileSystemObject")
> >> > Set MyFileContents = Nothing
> >>
> >> > Dim InputFile
> >> > InputFile = InputBox("Nom du fichier")
> >>
> >> > 'Get the file contents
> >> > Dim MyFileContents
> >> > Set MyFileContents = fso.OpenTextFile(InputFile)
> >>
> >> > 'Loop through counting the lines
> >> > '
> >> > Do While Not MyFileContents.AtEndOfStream
> >> > s= MyFileContents.ReadLIne
> >>
> >> > linelength = len(S)
> >>
> >> > if linelength < 10 then
> >> > msgbox ctr
> >> > end if
> >> > 'msgbox "x" & x & vbcrlf &_
> >> > ' "linelength " & linelength & vbcrlf
> >> > if x <= linelength then
> >> > x = linelength
> >> > end if
> >> > ctr = ctr + 1
> >> > Loop
> >>
> >> > 'Return the file's line count
> >>
> >> > msgbox "File name " & InputFile & vbcrlf &_
> >> > "FileLineCount " & Ctr & vbcrlf &_
> >> > "Maximum Line length " & x
> >>
> >> > 'Cleanup
> >> > MyFileContents.Close
> >> > Set MyFileContents = Nothing
> >> > Set fso = Nothing
> >> > --------
> >> > TIA
> >> > prebble
> >
> > Here is my contestant for the quickest/simplest file line counter ...
> >
> > Function LineCount(sFilespec)
> > Const ForAppending = 8
> > with CreateObject("Scripting.FileSystemObject")
> > LineCount = .OpenTextFile(sFilespec, ForAppending).Line
> > end with
> > end Function
> >
> > I posted an example based on this technique a few days ago. And as I
> > recall, someone else showed it to me a few years back. I am told that
> > it is off by one count for empty files and files full of blank lines
> > (new line characters only - no other text).
>
> As with most things in life, perhaps we need to define what a line is (for
> counting purposes) before we can count them. If a file can contain more
> than one empty line, then an empty file must contain one empty line. And
> perhaps the definition of a line separator is necessary, such as vbLf. With
> these definitions, the following script shows that your function produces
> correct results; the script is attached also to avoid line wrap problems:
>
> Option Explicit
> MsgBox "started in " & vbCrLf & _
> WScript.CreateObject("WScript.Shell").CurrentDirectory
>
> fOverWrite "dummy.txt", ""
> MsgBox "Line count for empty file -- should be one (for one empty line): " &
> LineCount("dummy.txt")
> fOverWrite "dummy.txt", vbCrLf
> MsgBox "Line count for CrLf file -- should be two (for two empty lines): " &
> LineCount("dummy.txt")
> fOverWrite "dummy.txt", "Now is the time for all ..."
> MsgBox "Line count for one-line file -- should be one: " &
> LineCount("dummy.txt")
> fOverWrite "dummy.txt", "Now is the" & vbCrLf & " time for all ..."
> MsgBox "Line count for two-line file -- should be two: " &
> LineCount("dummy.txt")
> fOverWrite "dummy.txt", "Now is the" & vbCrLf & vbCr & " time for all ..."
> MsgBox "Line count for two-line file -- should be two: " &
> LineCount("dummy.txt")
> fOverWrite "dummy.txt", "Now is the" & vbCrLf & vbLf & " time for all ..."
> MsgBox "Line count for three-line file -- should be three: " &
> LineCount("dummy.txt")
>
> Function LineCount(sFilespec)
> Const ForAppending = 8
> with CreateObject("Scripting.FileSystemObject")
> LineCount = .OpenTextFile(sFilespec, ForAppending).Line
> end with
> end Function
>
> Sub fOverWrite(FilePath, sData)
> 'Try writing ASCII file.
> 'If error occurs, try writing Unicode file
> Dim objFSO 'Global file system object
> Set objFSO = CreateObject("Scripting.FileSystemObject")
> Dim oTS
> Set oTS = objFSO.OpenTextFile(FilePath, 2, true)
> On Error Resume Next
> oTS.Write sData
> If Err then
> On Error GoTo 0
> oTS.close
> Set oTS = objFSO.OpenTextFile(FilePath, 2, true, -1)
> On Error Resume Next
> oTS.Write sData
> If Err Then
> msgbox "Error in fOverWrite - tried ANSI and Unicode" & vbcrlf & _
> "FilePath = " & FilePath & vbcrlf & _
> "sData = " & sData
> wscript.quit
> End If
> End If
> On Error GoTo 0
> oTS.Close
> End Sub
>
> -Paul Randall
>
>
>
My System SpecsSystem Spec
Old 08-05-2008   #6 (permalink)
mayayana


 
 

Re: Nifty line counter needed

Quote:

>
> Here is my contestant for the quickest/simplest file line counter ...
>
> Function LineCount(sFilespec)
> Const ForAppending = 8
> with CreateObject("Scripting.FileSystemObject")
> LineCount = .OpenTextFile(sFilespec, ForAppending).Line
> end with
> end Function
>
That is a nice method. I remember you posting
it but I didn't really pay attention. When people
start using "With CreateObject" my eyes glaze over.
It's too much trouble to decipher what their code
is actually doing.


My System SpecsSystem Spec
Old 08-06-2008   #7 (permalink)
Al Dunbar


 
 

Re: Nifty line counter needed


"mayayana" <mayaXXyana@xxxxxx> wrote in message
news:uWkiGM29IHA.4956@xxxxxx
Quote:

>
Quote:

>>
>> Here is my contestant for the quickest/simplest file line counter ...
>>
>> Function LineCount(sFilespec)
>> Const ForAppending = 8
>> with CreateObject("Scripting.FileSystemObject")
>> LineCount = .OpenTextFile(sFilespec, ForAppending).Line
>> end with
>> end Function
>>
>
> That is a nice method. I remember you posting
> it but I didn't really pay attention. When people
> start using "With CreateObject" my eyes glaze over.
> It's too much trouble to decipher what their code
> is actually doing.
I disagree. I can't live WITHOUT WITH! ;-)

/Al


My System SpecsSystem Spec
Old 08-06-2008   #8 (permalink)
prebble


 
 

Al Dunbar wins Gold.

Thanks Guys, for all the suggestions.
They all work. I didn't do any real benchmarking but here's what it looks
like ...

Bronze medal for Mayayana.
Some of my text files are gigantic datbase migration exports. So bronze for

Silver for Soler.
Was apparently faster but also implies a read of the data. (Good old DOS.)

Al Dunbar wins Gold.
I added a Msgbox to the end to display the result and it pops up
immediately.
Even on the big big files.

Thanks again,
Prebble






My System SpecsSystem Spec
Old 08-06-2008   #9 (permalink)
Tom Lavedas


 
 

Re: Al Dunbar wins Gold.

On Aug 6, 4:08 am, "prebble" <preb...@xxxxxx> wrote:
Quote:

> Thanks Guys, for all the suggestions.
> They all work. I didn't do any real benchmarking but here's what it looks
> like ...
>
> Bronze medal for Mayayana.
> Some of my text files are gigantic datbase migration exports. So bronze for
>
> Silver for Soler.
> Was apparently faster but also implies a read of the data. (Good old DOS.)
>
> Al Dunbar wins Gold.
> I added a Msgbox to the end to display the result and it pops up
> immediately.
> Even on the big big files.
>
> Thanks again,
> Prebble
Al Dunbar? I didn't see that he had a horse in the race. No offense
Al, but do we look that much alike?

Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/
My System SpecsSystem Spec
Old 08-06-2008   #10 (permalink)
mayayana


 
 

Re: Nifty line counter needed

> I disagree. I can't live WITHOUT WITH! ;-)
Quote:

>
With the disclaimer that I realize this is all
a mostly matter of personal taste...

I'm not faulting With. It makes a lot of
sense for repeat calls to the same object.
The code doesn't have to repeatedly get a
reference to that object and the flow of the
code is more clear. But there are a few things,
like use of colons to glue lines together and
extreme "With" that, while good for writing
terse code, make it difficult to follow what
the code's doing. Tom's line counting code
is great but the way it's written "hides"
Textstream. For someone with experience it's
a bit confusing and needs to be decrypted. For
someone who's not so familiar with Textstream
it's downright confounding.


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
The CPU counter is always at 50% General Discussion
Nifty Contacts Import Tool! Live Mail
more characters in a line needed Vista mail
Printer page counter needed Vista General
Counter problem Vista mail


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46