Burgaud Posted September 17, 2021 Share Posted September 17, 2021 (edited) I have an APP that periodically writes logs to a logfile And I wrote an autoit script that constantly observe this logfile's file timestamp using local $date = FileGetTime( $HISTORYFILE, 0, 1 ) ;last modified, string format if @error=0 AND $_PrevDate<>$date then $_PrevDate = $date $TimeOut = TimerInit() endif HOWEVER, I noticed that FileGetTime is not getting the correct result... BUt the moment I "refresh" the directory, it immediately gets the correct datetime. What should I do?? Edited September 17, 2021 by Burgaud Link to comment Share on other sites More sharing options...
Burgaud Posted September 17, 2021 Author Share Posted September 17, 2021 FileGetSize does not fetch updated filesize as well.. All of these functions get updated the moment I open the folder with Windows' explorer Link to comment Share on other sites More sharing options...
Burgaud Posted September 17, 2021 Author Share Posted September 17, 2021 (edited) I manage to make it all work by inserting local $line = FileReadLine( $HISTORYFILE, -1 ) FileGetSize and FileGetDate now returns updated values.. now why must I need to do a read first? Edited September 17, 2021 by Burgaud Link to comment Share on other sites More sharing options...
Nine Posted September 17, 2021 Share Posted September 17, 2021 Maybe because the file is currently open by another application and has not being closed for awhile ? “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
JockoDundee Posted September 19, 2021 Share Posted September 19, 2021 On 9/16/2021 at 10:21 PM, Burgaud said: now why must I need to do a read first? Maybe add intermittent FileFlush()’s to your log writing app. Code hard, but don’t hard code... 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