MessageBox in jscript

This forum is for questions / discussions regarding development of addons / tweaks for MediaMonkey.

Moderator: Gurus

stoffel

MessageBox in jscript

Post 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) ));

Guest

Re: MessageBox in jscript

Post 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:

Post Reply