I'm in the process of writing a script that goes through a file line by line and parses it. I have an onscreen counter that increments each time it goes through a line, that is where I use the $LineCounter variable. The problem is that it spikes the cpu up to 100% while the counter is running. Is there a command like a vb DoEvents that will keep this from happening?
Here's is the piece of my code that opens the file and increments the counter. The $PVFFile variable is filled earlier in the program..The WriteToLogSuccessful is later in the program. While the counter is running it is not writing anything to a log...
code:
If Open(1,"E:\Invoices\PVF\$PVFFile") = 0
$UseridFound = "N"
$LineOfText = ReadLine(1)
While @Error = 0
$LineCounter = $LineCounter + 1
If InStr($LineofText,"USERID") <> 0
$UseridFound = "Y"
$Userid = SubStr("$LineOfText",8,25)
$Userid = Trim($Userid)
$Hour = SubStr(@Time,1,2)
$Min = SubStr(@Time,4,2)
$Sec = SubStr(@Time,7,2)
$UseridFileName = "$Userid@MonthNo@MDayNo@Year$Hour$Min$Sec.txt"
$WriteEmailUserIni = WriteProfileString("E:\Invoices\Email\EmailUser.ini","$UserEmailFile","User","$Userid")
$LogText = "Found userid $Userid, created $UseridFileName"
Gosub WriteToLogSuccessful
EndIf
AT(4,0) "Lines read - $LineCounter "
$LineOfText = ReadLine(1)
Loop
EndIf
Thanks in advance...