newber Posted June 25, 2012 Posted June 25, 2012 What i am trying to do is read the value of an input box and then find that value in a text file, so i can copy the text that follows the space after the beginning of that line. Each entry in the text file starts with a 4 digit number followed by a space and then the rest of the text i am looking to copy. So basically someone would enter a value in the input box and then hit a button that would find the appropriate text and copy whatever info if after the space. Any help would be greatly appreciated. Thank you very much.
JohnOne Posted June 25, 2012 Posted June 25, 2012 If each entry is on a separate line, the basic way would be to... Open the file ( FileOpen() ) Iterate through the lines of the file ( FileReadLine() ) Check The first 4 chars of each line ( StringLeft() ) Return the rest of the line if found ( StringTrimLeft() ) AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Venix Posted June 25, 2012 Posted June 25, 2012 (edited) Unfortunately I'm at college at the moment so I can't really help you with the code right now however In the help file I would suggest starting by reading up on fileopen, filereadline, stringinstr and while loops.Edit: Beat Me To It Woops (Didn't think about stringtrim silly me) Edited June 25, 2012 by Venix
newber Posted June 25, 2012 Author Posted June 25, 2012 Thank you both for the prompt response. I ll work on writing some code and posting it. So far i was using StringMid and I was able to open a file for reading and trim the first 6 characters i needed to eliminate and then copy the other 45 to the clipboard with Clipput. I am not sure though how i would go about matching it and then telling it that that's the line i want it to work with. Thanks again.
JohnOne Posted June 25, 2012 Posted June 25, 2012 Pseudo.. If $InputBox = StringLeft($FileReadLine,4) Then ;Line is found, the rest of it can be returned. Endif AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
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