Sign in to follow this  
Followers 0
stigma

Can autoit read from a txt logfile?

6 posts in this topic

Hi all,

I want to acomplish the following:

A program i want to automate generates a detailed log of all events. it dumps this info in basic text to a .txt file and updates it continously as the program runs.

Is there a way for autoit to read the textfile so I can code apropriate responses to the events this way? Could someone give m a quick and dirty example of how to, for example, compare the last line in the log to a known text string, and then execute a command based on the outcome of the comparison?

If the answer is yes, then here are some quick followup questions:

-Is there any way to ensure autoit reads the logfile often enough to not miss any lines logged? many events may happen every second, so it would not be sufficient to read the file again every second for example. Ideally it should be read every time it is changed, but this might be outside what qutoit is able to do, I dunno, so thats why i'm asking :)

-Is there a way to not have to read the entire .txt in order to get the lines I need? (ie. most recent event only). the log files can get quite long over time, andI immagine having to read 200KB of logfile many times a second could easily start bogging down the system.

Thanks for any and all help :D

-Stigma

Share this post


Link to post
Share on other sites



hmmmm, switching to an .ini would probably make this easier.


The below statement is False.The above statement is True.a lesson I learned from Greenmachine; give a man a code and he'll solve one problem. Teach a man to code and he'll solve all his problems.P.S please don't use autoIt as a virus creator/spyware maker(keyLogger especially)Cick this and help me[center]My Scripts:[/center][center]Port Scanner[/center]

Share this post


Link to post
Share on other sites

hmmmm, switching to an .ini would probably make this easier.

Sorry, I don't quite understand. Do you mean it would be easier to read from an .ini file? Why would it matter that the file (or extension) is called as long as the contents are in plain text?

-Stigma

Share this post


Link to post
Share on other sites

hmmmm, switching to an .ini would probably make this easier.

How will he manage that, as his program isn't the one generating the log file? it is the program he wishes to automate.

Try searching the forum, as this question has been asked before.

For example, this thread may get you going in the right direction:

http://www.autoitscript.com/forum/index.ph...read++log++file

Share this post


Link to post
Share on other sites
:D Only one thing I know that generates that kind of log file other than window programs themselves :):D

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Hi,

Blademonkey wrote something for a chat log;

http://www.autoitscript.com/forum/index.ph...st&p=222756

[Tailchat_2.2.1.au3], updated in same thread.

I think he could have sped up the last-line read (if he had needed) if he had used my millisec tailread; see link in my signature.

Best, Randall

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  
Followers 0