MessageBox in jscript

Post a reply

Smilies
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: MessageBox in jscript

Re: MessageBox in jscript

by Guest » Sun Nov 15, 2009 12:32 pm

stoffel wrote:Well, I prefer doing my MM scripting in JScript. One thing I was missing is the MessageBox function. The problem was that MessageBox want a VBSArray (Associative Array) as argument which cannot be supplied by JScript.

Here's my solution:

function JS2VBArray( objJSArray )
{
var dictionary = new ActiveXObject( "Scripting.Dictionary" );
for ( var i = 0; i < objJSArray.length; i++ )
{
dictionary.add( i, objJSArray[ i ] );
}

return dictionary.Items();
}

SDB.MessageBox("Wow! JScript Message", 2, JS2VBArray( new Array(4) ));
Sorry, a small fix:

SDB.MessageBox("Wow! JScript Message", 2, JS2VBArray(new Array(mbOk.toString())));

works better :oops:

MessageBox in jscript

by stoffel » Fri Nov 13, 2009 7:23 am

Well, I prefer doing my MM scripting in JScript. One thing I was missing is the MessageBox function. The problem was that MessageBox want a VBSArray (Associative Array) as argument which cannot be supplied by JScript.

Here's my solution:

function JS2VBArray( objJSArray )
{
var dictionary = new ActiveXObject( "Scripting.Dictionary" );
for ( var i = 0; i < objJSArray.length; i++ )
{
dictionary.add( i, objJSArray[ i ] );
}

return dictionary.Items();
}

SDB.MessageBox("Wow! JScript Message", 2, JS2VBArray( new Array(4) ));

Top