Jump to content
Sign in to follow this  
yucatan

file reading binary

Recommended Posts

yucatan

hello guys i'm trying to make a script that checks if a file is getting bigger

and i am pretty far

but there is only one problem

when i have selected the file i wanne check

and it go's checking if it getting bigger

then he write a log in consolewrite

here is the log

the old len was 1167360 the new len is 4096
the old len was 4096 the new len is 1175552
the old len was 1175552 the new len is 1179648
the old len was 1179648 the new len is 1183744
the old len was 1183744 the new len is 1187840

i have only one problem

why he is saying 4096...... that not posseble because if u look in the script it only continues if the file is already bigger how is it posseble that is returns a lower value then can somebody help me on this

here is the script

$message = "Hold down Ctrl or Shift to choose multiple files."
$sfile = FileOpenDialog($message, @ProgramFilesDir & "\activision\Call of Duty 2\main\demos\", "Images (*.dm_1)", 1 + 4 )
$MyDocsFolder = "::{450D8FBA-AD25-11D0-98A8-0800361B1103}"
;$var = FileSaveDialog( "Choose a name.", $MyDocsFolder, "Scripts (*.dm_1;*.au3)", 2)
;ConsoleWrite(@CRLF&$iFileOp&@CRLF)
#Include <Array.au3>
$read1 = ""
$teller="0"
While 1 ;start a loop
$iFileOp = FileOpen($sFile, 16)  
;file is open start reading size
if $read1 = "" Then $read1 = FileRead($ifileop) ;this always repeat
$b1 = BinaryLen($read1)
$size = FileGetSize($sfile)


do
$teller +=1
$size1 = FileGetSize($sfile)
until $size1 > $size or $teller = 2000000
            if $teller = 2000000 then 
                MsgBox(4096, "Test", "error your not recording", 10)
                Exit
            EndIf
$teller = "0"
Sleep(100)
$read2 = FileRead($ifileop) ;this always repeat
sleep(100)
$b2 = BinaryLen($read2)
ConsoleWrite("the old len was "&$b1&" the new len is "&$b2&@CRLF)


$read1 = $read2
WEnd

Share this post


Link to post
Share on other sites
SmOke_N

You never close the file, look at how many handles that has open! Try closing it at the end of the loop under $read1 = $read2 and see if that makes a difference.

Too look any further, use proper indentation, I can't stand trying to debug peoples work that just slop stuff together.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
yucatan

You never close the file, look at how many handles that has open! Try closing it at the end of the loop under $read1 = $read2 and see if that makes a difference.

Too look any further, use proper indentation, I can't stand trying to debug peoples work that just slop stuff together.

yeah that problem is fixen now thx alot mate your advize workes i didnt closed the file

thx for ur quickly reaction

greetz yucatan

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  

×