'//////////////////////////////////////////////////////////////////////////////
' Author: SYOU
' Version 1.0
' Company: Etude
Conception Informatique
' Purpose: Copy a binary
file to another place
'//////////////////////////////////////////////////////////////////////////////
const source_file
= "C:\Users\Public\Videos\Sample Videos\Wildlife.wmv"
const destination_file =
"C:\Temp\Faune.wmv"
main()
Sub main()
Dim fso, ScriptEZ
Set fso = CreateObject("Scripting.FileSystemObject")
Set scriptEZ = CreateObject("ScriptEZ.API")
ScriptEZ.AppRegister
' opening
source file
hFileBinary
= ScriptEZ.OpenBinaryFile(source_file)
IF fso.FileExists(destination_file)
Then fso.DeleteFile(destination_file)
hFileBinary2 = ScriptEZ.OpenBinaryFile(destination_file)
If hFileBinary > 0 Then
Dim totalSize,dataSize
totalSize
= 0
Do Until(0)
pData = ScriptEZ.ReadBinaryFile(hFileBinary)
dataSize
= ScriptEZ.ReadBinaryBytes(hFileBinary)
If pData > 0 And dataSize > 0 Then
bsData = ScriptEZ.BinaryToBSTR(pData,dataSize)
totalSize
= totalSize + dataSize
ScriptEz.SetConsoleTitle
"Read " + CStr(CLng(totalSize/1024)) +
" Kbytes | " + _
CStr(CLng(ScriptEZ.ProbeMemoryStatus(7)/1024)) + "
Kbytes in use"
pNewData
= ScriptEZ.BSTRToBinary(bsData)
r = ScriptEZ.WriteBinaryFile(hFileBinary2,pNewData,dataSize)
ScriptEZ.FreeString
pNewData
Else
Exit Do
End If
WScript.Sleep 10
Loop
ScriptEZ.CloseBinaryFile
hFileBinary
ScriptEZ.CloseBinaryFile
hFileBinary2
End If
MsgBox "Done"
Set scriptEZ = Nothing
End Sub