WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: cseymore on May 03, 2017, 01:01:38 PM

Title: Importing data from Excel file into another program
Post by: cseymore on May 03, 2017, 01:01:38 PM
Hello.  I wanted to ask if anyone out there has had an success importing data from an Excel file into medical software or any other software using Winbatch and if you wouldn't mind sharing how you accomplished this? Thanks
Title: Re: Importing data from Excel file into another program
Post by: stanl on May 04, 2017, 03:48:37 AM
I wrote WB code to fill out HCFA Claims and it used Excel. But at this point your question is too general. You need to provide specifics on the type of Excel files, i.e. are they in tabular format etc...   and the destination ( database, web form etc...)
Title: Re: Importing data from Excel file into another program
Post by: cseymore on May 05, 2017, 12:30:42 PM
Hi Stanl,

Lets forget about excel file. I have attached a document in which contains some of the items that we're trying to import into our Meditech system using Winbatch. We're attempting to try to automate the process of posting payments into our system.  I have listed my WB script below and I seem to get stuck at the "acct = StrTrim(StrSub (line,7,10))   SendKey(acct)" section. Winbatch script below does not produce an error message in Winbatch,  however when it gets to the section of trying to pull in the Acct# a message pops up saying "This is a required field". lt's like the script is not finding the account number in the file. Thanks


TimeDelay (1)
handle=FileOpen("C:\remit-manager.txt","READ")
acct=""
line=FileRead(handle)
TimeDelay(3)
@wn=wingetactive()
   
      SendKey('20')
      SendKey('{ENTER}')
      SendKey('8')
      SendKey('{ENTER}')
      SendKey('{t}')
      SendKey('{ENTER}')
      SendKey('{F9}')
      SendKey('{2}')
      SendKey('{ENTER}')
      SendKey('{N}')
      SendKey('{ENTER}') 
      SendKey('{ENTER}')
      SendKey('{T}')
      SendKey('{ENTER}')
      SendKey('{ENTER}')
      SendKey('{ENTER}')
      SendKey('{ENTER}')
      SendKey('{ENTER}')
      SendKey('{ENTER}')
      SendKey('{ENTER}')
      SendKey('{ENTER}')
      SendKey('{ENTER}')
      SendKey('{ENTER}')
      SendKey('{ENTER}')
      SendKey('{ENTER}')
      SendKey('{ENTER}')
      SendKey('{ENTER}')
      SendKey('{Y}')
      SendKey('{ENTER}')
while @TRUE
      acct = StrTrim(StrSub (line,65,7))
      SendKey(acct)
      SendKey('{ENTER}')
      SendKey('{ENTER}')
      SendKey('{ENTER}')
      SendKey('{ENTER}')
      SendKey('{ENTER}')

TimeDelay(3)

      endwhile
FileClose(handle)
     
     
Title: Re: Importing data from Excel file into another program
Post by: morenos1 on May 05, 2017, 12:59:35 PM
This could work for you: http://www.winautomation.com/web-automation/
Title: Re: Importing data from Excel file into another program
Post by: td on May 05, 2017, 02:27:48 PM
Quote from: cseymore on May 05, 2017, 12:30:42 PM

while @TRUE
      acct = StrTrim(StrSub (line,65,7))
      SendKey(acct)
      SendKey('{ENTER}')
      SendKey('{ENTER}')
      SendKey('{ENTER}')
      SendKey('{ENTER}')
      SendKey('{ENTER}')

TimeDelay(3)

      endwhile
FileClose(handle)
         

You likely have a focus problem and certainly have an infinite loop...  If you have a recent version of WinBatch, you might want to consider using the new WinMacro if you choose to stick with your keystroke recording approach.
Title: Re: Importing data from Excel file into another program
Post by: stanl on May 06, 2017, 09:48:01 AM
that we're trying to import into our Meditech system using Winbatch

so is this a database, or a web form or something else.  I could see using sendkeys to go to a printer but WB has better methods to get data to db or the web.  Also I would consider pre-parsing the .txt into a database table.