Wow, been using VBScript forever. Just recently started using Javascript more
and more (I used to do a lot of Javascript, but switched because we weren't
allowed to where I work...now we can).
So, now that I have the knowledge of the scripting objects, I tried implementing
the Scripting.Dictionary object in JavaScript (passing it back and forth to
VBScript contained in an IE window). Ya know, you have to go through a few hoops
to get the Dictionary to function properly in Javascript.
IE:
var dict = new ActiveXObject('Scripting.Dictionary');
dict.Add('Key1', 'Value1');
dict.Add('Key2', 'Value2');
dict.Add('Key3', 'Value3');
var keys = new VBArray(dict.Keys()).toArray();
var vals = new VBArray(dict.Values()).toArray();
// To iterate through the arrays using an index...
for (var i = 0; i < keys.length; i++) {
// Just storing the value into a buffer.
buf += '\n' + keys[i] + ' = ' + vals[i];
}
Kinda nuts eh? Darn SafeArrays.
Mythran