ByteArray usage

Article | Member of  ScriptUtils.ByteArray | Changes | Purchase | Download

1. Identities


Library name: Script Utilities library
Library code: ScriptUtilities
Library CLSID: 41ABB943-5D82-11D3-9DD5-204C4F4F5020
ProgID: ScriptUtils.ByteArray
Library file name: ScptUtl.DLL

2. Scripting engines without types (VB Script, JavaScript, JScript, WSH, ASP)


   You can create the object using CreateObject function:
Dim ByteArray
Set ByteArray = CreateObject("ScriptUtils.ByteArray")
ByteArray.SomeMethod SomeParameters
ByteArray.SomeProperty = SomeValue

   You can also use CreateObject method method of Server object (ASP) to put the ByteArray object to page scope or CreateObject method of WScript object in WSH.

   You can also put the object to Application or Session scope using <object ...> tag in global.asa

<object runat="server" scope="application" id="ByteArray"
 progid="ScriptUtils.ByteArray">
</object>

Please use ActivexObject object in JScript/JavaScript to create ByteArray object:

var ByteArray;
ByteArray = new ActiveXObject("ScriptUtils.ByteArray");
ByteArray.SomeMethod(SomeParameters)
ByteArray.SomeProperty = SomeValue
...

3. VBA (VBA 5, VBA 6, Visual Studio, Word, Excel, MS Access, ...)

VBA 5/6: You can reference the library using menu Project -> References -> select 'Script Utilities library' in the listbox (or Project -> References -> Browse -> select ScptUtl.DLL file).
MSAccess, Word, Excel: Tools -> Macro -> Visual Basic Editor, then Tools -> References
Then you can write:

Dim ByteArray As New ScriptUtilities.ByteArray
ByteArray.SomeMethod SomeParameters
ByteArray.SomeProperty = SomeValue
    ...
or
Dim ByteArray As ScriptUtilities.ByteArray
...
Set ByteArray = New ScriptUtilities.ByteArray
ByteArray.SomeMethod SomeParameters
ByteArray.SomeProperty = SomeValue
...
You can use CreateObject function also, of course:
Dim ByteArray As ScriptUtilities.ByteArray
...
Set ByteArray = CreateObject("ScriptUtils.ByteArray")
ByteArray.SomeMethod SomeParameters
ByteArray.SomeProperty = SomeValue
...

4. Visual Studio .NET (ASP.Net, VB.Net, C#, J#)

    You can reference the library using menu Project -> Add reference -> COM tab -> select 'Script Utilities library' in the listbox -> click Select. Then you can write (C#, J#):

 //create  a new ByteArray object
ScriptUtilities.ByteArray ByteArray = new ScriptUtilities.ByteArrayClass();
ByteArray.set_String("Some text value");






String SQL;
SQL = "Insert Into Table (BinaryColumn) values (0x" + ByteArray.get_HexString() + ")"; ...
or (VBA)
Dim ByteArray As New ScriptUtilities.ByteArray 
ByteArray.SomeMethod(SomeParameters)
ByteArray.SomeProperty = SomeValue

5. T-SQL, MS SQL stored procedures and functions

DECLARE @ByteArray INT, @OLEResult INT 
EXECUTE @OLEResult = sp_OACreate 'ScriptUtils.ByteArray', @ByteArray OUT
IF @OLEResult <> 0 PRINT 'Error create component ByteArray'

--Set a property of ByteArray.
EXECUTE @OLEResult = sp_OASetProperty @ByteArray, 'PropertyName', @SomeSQLValue
IF @OLEResult <> 0 PRINT 'PropertyName set problem'

--Get a value of a property of ByteArray.
EXECUTE @OLEResult = sp_OAGetProperty @ByteArray, 'PropertyName', @SomeSQLValue OUTPUT
IF @OLEResult <> 0 PRINT 'PropertyName get problem'

--Call some method of ByteArray.
EXEC @OLEResult = sp_OAMethod @ByteArray, 'MethodName', 
 @ReturnValue OUTPUT, @parameter1, @parameter2

5. Other programming environments

   Please see documentation of your programing environment, work with COM objects (OLE objects, ActiveX objects). ByteArray is a standard COM object, it can work with other environments, such are Delphi or PowerBuilder.

© 1996 - 2011 Antonin Foller, Motobit Software | About, Contacts | e-mail: info@pstruh.cz


Other Motobit links:   IISTracer, real-time IIS monitor   ASP file upload - upload files to ASP. 
ActiveX/VBSScript registry editor  ActiveX NT User account manager  Export MDB/DBF from ASP Active LogFile  Email export  ActiveX/ASP Scripting Dictionary object