Jump to content

More general Windows OS questing regarding FileGetSize


Recommended Posts

OK, here's the sample code.

'TailRW.au3'
 
 Dim $tSize=0, $tOutput='', $tFile = @ScriptDir&'\wget.log'
 $hFile = _APIFileOpen($tFile)
 
 While ProcessExists('wget.exe')
    $nSize = FileGetSize($tFile)
    ConsoleWrite($nSize&@CR)
    If $nSize <> $tSize Then
                If $tSize > $nSize Then $tSize = 0
        _APIFileSetPos($hFile, $tSize)
        $Tmp = _APIFileRead($hFile, $nSize - $tSize)
        If @error <> 0 Then
            $tOutput = $tOutput & $Tmp
            $tOutput = StringRight($tOutput, StringLen($tOutput) - StringInStr($tOutput, @LF, 0, -10))
            GUICtrlSetData($Edit1, $tOutput)
            $tSize = $nSize
        EndIf
    EndIf
    Sleep(1000)
 WEnd
 _APIFileClose($hFile)

While wget is working and logging, the size of the logfile is checked. Very often, the changes of the filesize are not recognized and it keeps telling the old filesize. About 5-20 (?) seconds the filesize is constant, although I can see that the file is changing if I use a tail executable to monitor it. So there has to be a change, since each letters must eat up one byte. I also tried another diskspace-utiliy named du and parsed the output, put surprise, surprise, it did not work either. So it seems to be a general issue.

I use WinXP Pro with the latest updates and AutoIt 3.2.10. The install is a few days old. That's all. I even uninstalled avira to see if the guard-software was blocking the script, but that's not the case.

Does anyone have an idea what could cause that problem? It seems kind of fishy.

It does work correctly if use stderrread on wget and I might/will use it, but this kind of bugs me.

Best regards

Dabus

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
 Share

  • Recently Browsing   0 members

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