All Things WinBatch > Customer Service

My winbatch script starts pulling data incorrectly from a certain line

(1/1)

cseymore:
Here is my data from a notepad text file that I am importing into my EHR software system using winbatch.  The script that I have runs great until it gets to the line with "V394". It pulls the "V394", then pulls "01", pauses, and then attempts to pull "V182" totally passing the text (010715 Letter THRMCS4 TOO-HRMC S) next to it.  I have listed my winbatch script below.  The script should pull the data one line at a time and then when its finished with that line, proceed to pulling the data on the next line.  Could someone take look at this to see what could possibly be the problem?  Thanks!

   612          V4          010715 Letter THRMCS1 TOO-HRMC S
   612          V185      010715 1 LTR satisfied PL95
   612          V66        010715 Letter THRMCS1 TOO-HRMC S
   612          V66        010715 1 LTR updated for MADEUP N
   612          V328      010715 AME (POR)
   612          V396      010715 EBO MAILING STATEMENT TO
   612          V264      010715 GUARANTOR ADDRESS TODAY. N
   612          V97        010715 Put something here to fill space
   612          V394    010715 Letter THRMCS4 TOO-HRMC S
   612          V182      010715 4 LTR satisfied PL95
   612          V81        010715 Letter THRMCS4 TOO-HRMC S
===================================================================================================
TimeDelay (1)
handle=FileOpen("C:\harmc_notes010816_test.txt","READ")
acct=""
comm=""
line=FileRead(handle)
TimeDelay(1)
@wn=wingetactive()

while @TRUE
      acct = StrTrim(StrSub (line,16,10))
      comm = StrTrim(StrSub (line,27,300))
      SendKey(acct)
      SendKey('{ENTER}')
      SendKey('45')
      SendKey('{ENTER}')
      SendKey('N')
      SendKey('{ENTER}')
      SendKey('{ENTER}')
      SendKey('{ENTER}')
      SendKey('{ENTER}')
      SendKey('MOSAIC') 
      SendKey('{ENTER}')
      SendKey('{ENTER}')
      SendKey(comm)
      SendKey('{F12}Y{ENTER}')
TimeDelay(3)

      line=FileRead(handle)           
      ;;;@wn=wingetactive(1)
endwhile

FileClose(handle)



 

td:
Your script has a basic flaw.  You do not test the return from FileRead for the "*EOF*" string.  Because you don't,  you have an infinite loop.

Since the file contents you show has had one or more cut and paste operations performed on it, you will have to figure out why your script isn't reading a line correctly.  You likely have embedded non printable characters that are causing issues for what ever method you are using to view the lines read from the file.  The offending characters could be the result of the file actually being UTF-8 instead of a Windows code page.     

cseymore:
Thanks td. That fixed my problem.

Navigation

[0] Message Index

Go to full version