Struggling 2

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
edauthier
Pro Scripter
Posts: 84
Joined: Sun Apr 13, 2003 1:26 pm
Location: USA

Struggling 2

Post by edauthier » Fri Oct 24, 2003 6:20 pm

I could also use a line count written to another text file. So it would read the number of lines with data in a text file and then write that 'total' number to another text file. I have an everyday script to send the message to the screen.

Here's that:
const filename="S:\your file\your_info.log"
set fso=createobject("scripting.filesystemobject")
set ofile=fso.opentextfile(filename)
strcontents=ofile.readall
ofile.close
set ofile=nothing
set fso=nothing
acontents=split(strcontents,vbcrlf)
wscript.echo "REJECTIONS : " & cstr(ubound(acontents)+1)

This is run outside of MS...

Thanks in advance, Ed

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Sat Oct 25, 2003 12:31 am

In your earlier post, you said that were reading every line. Just add a line to increment a counter with every line read. When EOF then send count to file. Something like this:
Label>Start
Let>Line=0

Label>Read
Add>Line,1
ReadLn>%SourcePathFileName%,%Line%,Result
If>Result=##EOF##,Done,Read

Label>Done
//Reduce counter by one for last count which was for EOF
Sub>Line,1
//Send line count to a text file
WriteLn>%PathFileName%,result,%Line%
MessageModal>%SourcePathFileName% has %Line% lines.

Label>End
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts