Jump to content
Sign in to follow this  

Use AutoIt to monitor a text file

Recommended Posts

There is a certain program that is always writing to a log file that is in text format. How can AutoIt be used to constantly monitor what is being written to this text file and take certain actions depending on what new output it sees?

Share this post

Link to post
Share on other sites

Infinite loop containing FileRead

Well, maybe a loop that checks the time stamp or filesize and reads it only if changed.


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post

Link to post
Share on other sites

i coded this filewatcher ~~ one week ago

; File watcher

$INI = @ScriptDir & "\Settings.ini"
$filename = IniRead($INI, "watching", "filename", ""); Filename
$string = IniRead($INI, "watching", "stringtosearch", ""); String writed to file by bot
$do = IniRead($INI, "watching", "filerun", ""); Run a file after text in file
$exit = IniRead($INI, "watching", "exitiffound", ""); Exit if string was found?

$delay = IniRead($INI, "delays", "searchdelay", ""); Time between loop wil check file again

$File = FileOpen($filename, 0) ; 0 - Read Mode

While 1
If FileReadLine($filename, 1) = $string Then ; If first line of file is our string then...
    ShellExecute($do); Run a file
        If $exit = "true" Then
sleep($delay * 1000)


This should be useful for u

Edited by Sobiech

This world is crazy

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...