Sign in to follow this  
Followers 0
jgg

Checking File-gime - 10 Minutes

5 posts in this topic

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....

Share this post


Link to post
Share on other sites



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]"


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

How do i access a date_diff?

When will it be available? will it come a new release to autoit v3 with the enchangement?

Share this post


Link to post
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....

Thanks....

Share this post


Link to post
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)
Tooltip("")
if $y=$x then dosomething()
sleep(10)
wend

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

AutoIt3, the MACGYVER Pocket Knife for computers.

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