Automatically called scripts can't be JScript

This forum is for reporting bugs in MediaMonkey for Windows 4. Note that version 4 is no longer actively maintained as it has been replaced by version 5.

Moderator: Gurus

DanielWebb
Posts: 32
Joined: Thu Sep 28, 2006 5:17 am

Automatically called scripts can't be JScript

Post by DanielWebb »

As discussed in a previous post we can't use JScript to code scripts in the auto folder.

To Reproduce:

create a file called, say, testJScript.js in the MediaMonkey/scripts/auto folder and past the following code into it:

Code: Select all

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

function ShowIt()
{
	SDB.MessageBox(SDB.Localize("ShowIt function called correctly."), mtError, mbOk);
}
Restart MediaMonkey, right click on the mediamonkey tray icon and select the new "TestJScript" menu item.

Error reported is:

"Error #1032 - Microsoft VBScript compilation error"

Now I'm not sure this is a bug - (the scripting.doc file has a section titled "Automatically called Scripts" that states:
"All .vbs scripts in Scripts\Auto folder are automatically checked during MM start-up and in case there is ‘OnStartup’ procedure present, it is called"
But I really want to get on with some MediaMonkey Scripting and VBScript sucks the creativity out of me.


Please consider fixing this - It'll definitely be worth your while.
Regards

Daniel Webb
www.planetgriff.com
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

It would be nice if this was fixed. I learnt VBScript solely for the purpose of MM scripting, because I couldn't get JScript to work properly.

I often have to go through my VBScripts after I've finished coding a chunk and take all the semi-colons off the end of each line! :lol:
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Lowlander
Posts: 58631
Joined: Sat Sep 06, 2003 5:53 pm

Post by Lowlander »

So you admit that VBScript is better as you have less code (no semicolon) :wink: .
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

It took me a LONG time to get used to putting "End If" with the space in it after If statements. But this is more because I am a Uniface developer by trade and in Uniface you end an "if" with "endif". All these languages - it's sooooo confusing! :-? :lol:
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Lowlander
Posts: 58631
Joined: Sat Sep 06, 2003 5:53 pm

Post by Lowlander »

Standarization of code sintaxis accross languages would be a good thing for all of us.
Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm

Post by Steegy »

Code: Select all

... and VBScript sucks the creativity out of me
Why? VBScript is virtually the same as JScript. Only differences are Sub->function, {}, casing, built-in functions, ... but basicly the same functionality is present.
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
drichm
Posts: 53
Joined: Wed Apr 06, 2005 1:12 am
Location: Switzerland

Post by drichm »

Steegy wrote:VBScript is virtually the same as JScript. Only differences are Sub->function, {}, casing, built-in functions, ... but basicly the same functionality is present.
I could not disagree more!!!!

I have programmed both plus others and I can quite categorically state that VB is by far the worst of the lot (with the possible exception of Perl).

I have also requested JavaScript/JScript support before. In fact, could all other ActiveX/OLE/... supporting script languages (e.g. Python) also be supported?

Dave

P.S. Is the problem adding the SDB object to the scripting namespace?
Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm

Post by Steegy »

MM uses the Microsoft Scripting Host, which is able to run VBScript and JScript. I just think that the devs didn't implement the JScript part 100% ok.

BTW: I was only talking about VBScript & JScript. I know that other languages (c, c++, java, php, c#, ...) are more powerful and "following the consistency standards". But I (with emphasis on I) haven't yet come across a script in JScript that couldn't be converted to VBScript. Microsoft tends to give VBScript a little bit more support, because it's "their" language, so sometimes VBScript can do things that are less easy in JScript (but usually it's possible).

Anyway you're right, and I back your request to fix the JScript support.
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
DanielWebb
Posts: 32
Joined: Thu Sep 28, 2006 5:17 am

Post by DanielWebb »

The more languages the merrier as far as I'm concerned. Choice is good. Big respect to the MediaMonkey coders for implementing scripting at all.

I'm just hoping that this is a fairly trivial one to fix.
Regards

Daniel Webb
www.planetgriff.com
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

Scripting support at all is certainly fantastic - it's one of the main reasons I use MediaMonkey.

I like the fact that most people use VBScript, as it makes sharing script easier. However, I do believe that people should be given the choice, as not everyone is prepared to learn VBScript, especially if they already know JScript.
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Post Reply