Eric's Webspace
Use Byte Arrays In Scripts
Download Now!Download Now!

People who use Windows Scripting who get stuck with a byte array have no easy way to do anything with it. So I wrote a very simple control to allow the byte array to be saved to disk or be converted into a string. The control was written with Microsoft's free VB5CCE and comes with source code.  FYI, if you need to do the opposite (create a byte array from a disk file), take a look at my Microsoft q193998 control.

Click the "Download Now!" icon (above right) to get the OCX, source code, and sample VBS code showing how to use the control.

To run the OCX, you'll need to have the Visual Basic 5 runtime files on your computer. You probably already have them, but if you don't, you can get the runtime files from either of these places:
Ziff-Davis HTTP  Microsoft FTP


Good News:   If you have Microsoft Data Access Components installed, you can save byte arrays with no special controls needed. Try script like this:

Sub SaveByteArray(strFileName, bytByteArray)
Const adTypeBinary = 1
Const adSaveCreateOverWrite = 2
Dim bin
Set bin = CreateObject("ADODB.Stream")
bin.Type = adTypeBinary
bin.Open
bin.Write bytByteArray
bin.SaveToFile strFileName, adSaveCreateOverWrite
End Sub 




Lost? Look at the site map.

Bad links? Questions? Send me mail.

Google
Yahoo
Ask Jeeves