Page 1 of 1

Automatically called scripts can't be JScript

Posted: Thu Sep 28, 2006 5:43 am
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.

Posted: Thu Sep 28, 2006 7:22 am
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:

Posted: Thu Sep 28, 2006 9:08 am
by Lowlander
So you admit that VBScript is better as you have less code (no semicolon) :wink: .

Posted: Thu Sep 28, 2006 9:55 am
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:

Posted: Thu Sep 28, 2006 12:04 pm
by Lowlander
Standarization of code sintaxis accross languages would be a good thing for all of us.

Posted: Thu Sep 28, 2006 7:21 pm
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.

Posted: Fri Sep 29, 2006 1:37 am
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?

Posted: Fri Sep 29, 2006 7:46 am
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.

Posted: Fri Sep 29, 2006 9:17 am
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.

Posted: Fri Sep 29, 2006 10:46 am
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.