jgg Posted March 14, 2004 Share Posted March 14, 2004 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) EndIf MsgBox(4096,"",@hour & ":" & @min & ":" & @sec) If @min + 60 > $t[4] Then MsgBox(0, "@min $t[4] " @min, $t[4]) Endif Thanks for help.... Link to comment Share on other sites More sharing options...
Developers Jos Posted March 14, 2004 Developers Share Posted March 14, 2004 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 More sharing options...
jgg Posted March 15, 2004 Author Share Posted March 15, 2004 How do i access a date_diff? When will it be available? will it come a new release to autoit v3 with the enchangement? Link to comment Share on other sites More sharing options...
jgg Posted March 18, 2004 Author Share Posted March 18, 2004 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.... Thanks.... Link to comment Share on other sites More sharing options...
scriptkitty Posted March 18, 2004 Share Posted March 18, 2004 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) Tooltip("") if $y=$x then dosomething() sleep(10) wend func dosomething() tooltip("File changed",0,0) endfunc AutoIt3, the MACGYVER Pocket Knife for computers. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now