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
JavaScript?
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
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
-
- Posts: 2157
- Joined: Fri Jan 14, 2005 1:45 am
- Location: Germany
- Contact:
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:
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
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);
}
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).