Jump to content
Sign in to follow this  
Eikoo

Monitor Log file, Close and relaunch program.

Recommended Posts

Eikoo

Hello,

I'm attempting to make my office a better place. The most coding I can do is take what I find on Google and attempt to modify it to my needs. Except this time I'm not really finding anything.

I'm trying to write a script to monitor an application. This app monitors codes that come in, This application crashes about ever 26 hours(multiple people share the same computer 24/7).  I've found there is a file C:Program Files(x86)MicrokeyLogLog that will show that it receives new codes. This file does not have a prefix at the end. Can I have it monitor this file for last time modified?

So if this file isn't updated in 5 minutes I want the application to be killed and restarted. 

 

Thanks for any help that is given,

Share this post


Link to post
Share on other sites
abberration

Here's something to toy with:

HotKeySet("{ESC}", "_Exit")
Do
$originalTime = FileGetTime("C:\Program Files(x86)\Microkey\Log\Log", 0, 1)
Sleep(3000) ; sleep 3 seconds
$currentTime = FileGetTime("C:\Program Files(x86)\Microkey\Log\Log", 0, 1)
If $originalTime <> $currentTime Then
    MsgBox(0, "Notice", "The log file has been changed.")
    $originalTime = $currentTime ; update the time of comparison to the current time
EndIf
Until _Exit

Func _Exit()
    Exit
EndFunc

RAID Calculator | Software Installer

The truth has been suppressed since the dawn of time.

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  

×