tomjermy Posted February 3, 2006 Posted February 3, 2006 Hi, I am looking for a piece of software which I can load a text file into, and tell the software which program window to apply the data that the text file contains to.If that doesn't make sense, I will give you my reason for it: We have an accounts system which I have to enter data into. I put the data into Excel to analyse it first. I then spend the majority of a whole day typing the data that I have got excel to generate in a second, into the accounts package.Each line of the 1000's of lines that are typed in can basically be summarised as: text string <tab> text string <tab> text string <tab> number <tab> text string <enter>I would like to do export the data from Excel, import it into a "keyboard simulator" program and have that direct the text file at a specific window - i.e. that of the accounts package.If anyone can help, I would be very appreciative.TomPS, I particularly like OSS/GNU solutions!
Fencer128 Posted February 3, 2006 Posted February 3, 2006 Hi,Forgive me for stating the obvious, but are you sure there's no way to import either excel or tab delimited data into your accounts package? That would definitely be the easiest way.Regards,Andrew
LLXX Posted February 4, 2006 Posted February 4, 2006 (edited) Is there a console version of the accounts package that reads from standard input? If so, thenprogname < filename.txtfrom the command prompt would be all that's needed.For a Windows program... a scripting solution like AutoIt might work. That problem is that there is no concept of "standard input" in Windows. Edited February 4, 2006 by LLXX
dougiefresh Posted February 4, 2006 Posted February 4, 2006 (edited) Hi! I would like to help you. I need some information first. If you type something in (let's say) Notepad and cut some text, can you paste into the accounting program? I'm also assuming that you have the ability to run external programs or install programs onto the machine, correct?EDIT: 3 days have passed since my reply..... Anyone there?EDIT2: Since 5 days have passed and no reply, I will write the AutoIT script for you, but you must edit it so that it selects the correct window. It will be later today before I can write it. Edited February 9, 2006 by dougiefresh
dougiefresh Posted February 9, 2006 Posted February 9, 2006 (edited) Here is the AutoIt script that I've written. Since you didn't reply, I could not add the appropriate window title or Excel output filename to script. I also assumed that since that you stated the following:Each line of the 1000's of lines that are typed in can basically be summarised as: text string <tab> text string <tab> text string <tab> number <tab> text string <enter>that it would be safe to assume that the information needed to be entered was seperated by Tabs within the accounting program. I know that the tab delimited format that Excel exports to is set up the same. So, without further ado, here you go:; User-editable variables$Input = "OUTPUT.TXT"$Title = ""; Changes the exit function to my exit function to make sure file handle is closed:AutoItSetOption( "OnExitFunc", "MyExitFunc" ); Open the file OUTPUT.TXT for read-mode. This file is the expected output file ; for the Excel program and must be present in order for this script to function.$File = FileOpen( $Input, 0 )if $File = -1 then MsgBox( 0, "Script Error", "Unable to open file """ & $Input & """. File must be present in the same folder as this script!" ) ExitEndif; Select the proper window in order to start feeding input file to it:if $Window_Name <> "" then MsgBox( 0, "Script Error", "No Windows title specified in order to select the correct window!" ) ExitEndifWinActivate( $Window_Name ); Begin parsing each line of the file and feeding it to the program expecting input:while 1; Read line into memory: $Line = FileReadLine( $File ) if @Error <> 0 then Exit; Parse the line using TABs as the divider: $Array = StringSplit( $Line, Chr(9) ) Send( $Array[1] & "{Tab}" & $Array[2] & "{Tab}" & $Array[3] & "{Tab}" & $Array[4] & "{Tab}" & $Array[5] & "{Enter}" )wendExitFunc MyExitFunc() if $File <> -1 then FileClose( $File ) ExitEndFuncYou may have to install AutoIT v3.1.0 (or later - found here) in order to retrieve the proper window title. Also, if tabs are inappropriate to seperate the information going into the accounting program, we may have to alter it some. Let me know if this works for you! Edited February 9, 2006 by dougiefresh
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now