convert JScript Array to Array Variant 
Author Message
 convert JScript Array to Array Variant

How can i convert JScript Array to Variant Array like
VBScript Array

because i send JScript array to my application as a
parametre but my application understand that parametre is
a object, because JScript Array is object, but i want
JScript Array as Variant

Tue, 13 Apr 2004 21:46:11 GMT  
 convert JScript Array to Array Variant


> How can i convert JScript Array to Variant Array like
> VBScript Array

Doable (but utterly ugly) way:

<?XML version="1.0" standalone="yes" ?>

<job id="JSArrayToVBS">
<?job error="true" debug="true" ?>

<script language="JScript"> <![CDATA[
var jAry = new Array("zero", "one", "two", "three", "four", "five");
var bundleOfJoy = pack(jAry)

function pack(Ary) {
 var oD = new ActiveXObject("Scripting.Dictionary");
 for (var i=0; i<Ary.length; i++) oD.add(i, Ary[i]);
 return oD.items();


]]> </script>

<script language="VBScript"> <![CDATA[
Dim vbAry
vbAry = unPack(bundleOfJoy)

MsgBox vbAry(0) & " to " & vbAry(UBound(vbAry))

Function unPack(oC)
 Dim Ary, vItem
 Ary = Array()
 For Each vItem in oC
  ReDim Preserve Ary(UBound(Ary)+1)
  Ary(UBound(Ary)) = vItem
 unPack = Ary
End Function
]]> </script>


Or you can download and install custom JSafeArray ActiveX component from:


Wed, 14 Apr 2004 02:57:38 GMT  
 [ 2 post ] 

 Relevant Pages 

1. converting Array to Variant and Variant to Array

2. convert jscript array to variant array

3. Help converting server-side VBScript array into client-side JScript array

4. wsh/ jscript : BUG : array of array, 2D array

5. Returning Variants That Contains an Array to JScript

6. Passing Variant Array to JScript function

7. Convert 2d array to 1d array

8. Convert multi-dimension vbscript array to javascript array

9. No way to convert JScript-Array to VBArray?

10. Passing variant containing byte array

11. Trying to pass a Variant Array of Doubles to ActiveX from HTML

12. Variant (array of bytes)


Powered by phpBB® Forum Software