I'm trying to create a macro that also calculates the size of the book. Each book consists of varying amounts of .SMIL, .MP3 and .HTML files.
This is some trial code I've been working on:
Code: Select all
Let>Path=E:\Data3\Original Mass Ingestest With Links\708310
//GetFileList>%Path%\*.*,strFiles,;
//GoTo>Skip
GetFileList>%Path%\*.smil,Files1,;
GetFileList>%Path%\*.mp3,Files2,;
GetFileList>%Path%\*.html,Files3,;
Let>strFiles=%Files1%+%Files2%+%Files3%
Label>Skip
Let>y=0
Let>ByteSize=0
Repeat>y
Let>y=y+1
Separate>strFiles,;,strNames
ExtractFileName>strNames_%y%,strFileName
FileSize>%Path%\%strFileName%,strFileSize
//SetRoundMode>3
Let>strFileSize={Round(%strFileSize%)}
If>ByteSize=0
Let>ByteSize=strFileSize
Else
Let>ByteSize=ByteSize+strFileSize
endif
Until>y=strNames_Count
Let>kByte={Round(%ByteSize%/1024)}
MessageModal>Size of book = %kByte%KB
If I run the code as presented above, it calculates it as 449868KB
If I uncomment the two lines at the start so that it counts all files instead of just .smil, .mp3, .html (even though the folder only contains these file types), it calculates it as 450129KB. Just 1KB out from what the validator says it should be.
There are no hidden files in the folder as far as I can tell.
What am I doing wrong? I can't work out why these two different methods would produce different results and why neither exactly matches that of the validator.
It's also worth noting that it's not consistent either in that sometimes if I run it on other folders, the second method calculates the same number as that of the DAISY Validator but never is the first method correct. I've tried using different rounding modes but that made no difference that was consistent on all folders.