Jump to content

Checking File-gime - 10 Minutes


Recommended Posts

I have a file i want to check. If the file isn't updated for ten minutes i want to restart a specific program. I can check file-time and the time right now, but how do i do to check if the file hasn't been updated for ten minutes?

$t = FileGetTime("C:\Program\FB\nn.log", 2)

If Not @error Then

$yyyymdttmmss = $t[0] & "/" & $t[1] & "/" & $t[2] & "-" & $t[3] & "." & $t[4] & "." & $t[5]

MsgBox(0, "Nn.log last changed", $yyyymdttmmss)


MsgBox(4096,"",@hour & ":" & @min & ":" & @sec)

If @min + 60 > $t[4] Then

MsgBox(0, "@min $t[4] " @min, $t[4])


Thanks for help....

Link to comment
Share on other sites

  • Developers

There will be a _datediff UDF available soon that will be able to calculate it for you.

Func _DateDiff($iType,$sdate,$eDate)

; Description:      Returns the difference between 2 dates, expressed in the type requested

; Parameter(s):  $iType - returns the difference in:

;                            d = days

;                            m = Months

;                            y = Years

;                            w = Weeks

;                            h = Hours

;                            m = Minutes

;                            s = Seconds

;                $sDate    - Input Start date in the format "YYYY/MM/DD[ HH:MM:SS]"

;                $eDate    - Input End date in the format "YYYY/MM/DD[ HH:MM:SS]"

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
Live for the present,
Dream of the future,
Learn from the past.

Link to comment
Share on other sites

Is there any way today to check if a file isn't updated for ten minutes?

Then datediff will come some time in the future said JdeB, but i need to have a solution today....


Link to comment
Share on other sites

I have a function that closes a window if it has been up for 10 min, think about this, not acurate as 10 min, but works.

; time test
while 1; change to while winexists("your program or something")
$x=FileGetTime ( "filename.txt" ,0)
;[optional] Flag to indicate which timestamp
;0 = Modified (default)
;1 = Created
;2 = Accessed
sleep(600000); ten minutes
$y=FileGetTime ( "filename.txt" ,0)
if $y=$x then dosomething()

func dosomething()
 tooltip("File changed",0,0)

AutoIt3, the MACGYVER Pocket Knife for computers.

Link to comment
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...