mayayana
Wed May 16 09:32:47 CDT 2007
You can do it to some extent. See here for an
example that writes icons to disk by reading the
icon bitmap bytes from a file, constructing a numeric
array as .ico header, then treating both of those as
string to write a .ico file to disk:
http://www.jsware.net/jsware/scripts.php3#iconextr
Textstream can handle byte data as long as it's
just asked to handle it and not "look too closely".
I don't know whether that will apply to your need
to write "byte arrays to a data source". Textstream
takes care of the details if you write byte arrays to file,
but what you have is not really byte arrays in VBS -
they're arrays of variants.
If you have VB6 then using VBS doesn't make
much sense in most cases. It's very slow and inefficient,
and it only deals with variants or objects. So handling
byte data is a slow, awkward dance.
The Run method that papou mentioned is basically
the same idea as Shell in VB6 or ShellExecute in API.
You can run a program but that's about it. If you're
going to take the trouble to write the VB6 version you
might consider an ActiveX DLL. You can then provide
your own custom object that can cater to the limitations
of VBS. For instance, you can provide a method that
accepts an array from VBS and then "cleans it up",
converting the data to byte.
>
> I'm a bit vexed by one of the limitations of VBscript. I have to
> write byte arrays to a data source, and there doesn't appear to be any
> way at all to do it. I can read them just fine, but have had no luck
> modifying and storing them back. I can do this just fine with VB6 but
> my shell app is in script.
>
> If I compile a little exe in VB6 to do this for me, is it possible to
> call it from a Script? I'm guessing not but I'm crossing my fingers
> here.
>
> Thanks
> Eric