Jump to content
Sign in to follow this  
TheSilence

Pull values with txt file

Recommended Posts

TheSilence

Hey all,

I am very new to AutoIt but have decent knowledge of Basic scripting language, I could use some help with an autoit script im working on though.

What I want to accomplish is, I want to pull data from within a closed txt document. Given that the data always has a static filename, and line and column reference.

Is this possible? or would the file need to be opened first. Either solution would work but pulling values from a closed file would be preferred. In either case if anyone could spare me some example script if, the given filename is say... "temp.txt" and I need to pull a 5 character string starting with line 5, column 30.

Any help would be greatly appreciated!!

Thanks,

Mike

Share this post


Link to post
Share on other sites
Authenticity

Either way you have to open the file to retrieve a handle to use those functions that query file size or line count, etc.

Share this post


Link to post
Share on other sites
seandisanti

Either way you have to open the file to retrieve a handle to use those functions that query file size or line count, etc.

you could copy the file first, then read from the copy, then delete the copy when you're done with it. it's not elegant, but it doesn't lock up the .txt file while you're reading it, which it sounds like is your goal.

Share this post


Link to post
Share on other sites
TheSilence

I dont necessarily mind the file being locked up, perhaps some background would be helpful...

I have a CMM measuring device and I am trying to automate output from the CMM devices software into our data collection software, None of the software reporting uses actual text, its all graphic reporting. So I have the software printing to file, from there I am trying to make AutoIt pick up the values out of the temp text report and throw them into the data collection software automatically, I am just trying to do it as quickly as possible without the user realizing its even running so they cant mess the script up. Thats the reason I was trying to do it without opening the actual file.

The main problem I am having is that I dont know how to script the portion to have AutoIt snag the number string out of the text document based on its line and column position. The report comes out the same every time, so I dont have to worry about these positions changing.

Any help would be greatly appreciated,

Mike

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.