JavaScript?

Download and get help for different MediaMonkey for Windows 4 Addons.

Moderators: Peke, Gurus

andig
Posts: 100
Joined: Thu Jul 29, 2004 2:15 am

JavaScript?

Post by andig »

Can I develop in JavaScript for MM? From the script folder it appears that also js should be supported, but I couldn't find any examples/ documentation anywhere. Even simple script doesn't work:

function OnStartup()
{
var UI = SDB.UI;
var Mnu = UI.AddMenuItem( UI.Menu_TrayIcon, -1, 1);
Mnu.Caption = "&Andi";
Mnu.UseScript = Script.ScriptPath;
Mnu.OnClickFunc = "ShowIt";
Mnu.IconIndex = 35;
}

function ShowIt()
{
SDB.MessageBox(SDB.Localize("Select tracks to be exported, please."), mtError, mbOk);
}

Any ideas?

Thanks,
Andi
rk
Posts: 104
Joined: Mon Jul 25, 2005 2:18 am
Location: Germany

Post by rk »

I am not quite sure, but I think you can just use JScript (instead of Java Script)
Last edited by rk on Thu Sep 08, 2005 2:34 am, edited 1 time in total.
Guest

Post by Guest »

But how? Not even a simple messagebox is working... CHM file only talks about VB.. are the object and function names even the same?
rk
Posts: 104
Joined: Mon Jul 25, 2005 2:18 am
Location: Germany

Post by rk »

Anonymous wrote:are the object and function names even the same?
Good question. I only do VBS and furthermore are rather new in it. Maybe one of the Gurus can help out ...
jiri
Posts: 5429
Joined: Tue Aug 14, 2001 7:00 pm
Location: Czech Republic
Contact:

Post by jiri »

I think that JScript works fine under MM, it's just MessageBox that has a problem. The correct syntax under VBS looks like:

SDB.MessageBox( "Something", mtInformation, Array(mbOk))

I'm not sure how VBS Array() should be written under JS. However, you can always create your own dialogs using UI elements.

Jiri
onkel_enno
Posts: 2157
Joined: Fri Jan 14, 2005 1:45 am
Location: Germany
Contact:

Post by onkel_enno »

Has anyone already written a working JScript for MM?
Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm

Post by Steegy »

Well, as Jiri said, the above script works except that clicking the added menu item results in an error. But the menu item is added, so the scipt partially works.

The code for the javascript (= JScript) clickhandler should be something like:

Code: Select all

function ShowIt(clickedMenuItem) 
{ 
	SDB.MessageBox(SDB.Localize("Select tracks to be exported, please."), mtError, mbOk); 
} 
The problem is that the clickhandler is executed as a VbScript instead of the JScript. That obviously results in language interpretion errors.

Please devs, take a look at this.
I've been thinking about doing some JScript programming too. (just for the change, these languages are almost the same anyway)

Cheers
Steegy
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
Post Reply