Possible bugs in the scripting system

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

Moderators: Peke, Gurus

Pablo
Posts: 554
Joined: Sun Feb 22, 2004 2:59 am

Possible bugs in the scripting system

Post by Pablo »

1) The statement

Code: Select all

AUserCreateNode.expanded=True
produces unpredictable results. The first time is called it seems to expand the parent node (if it's also user created), and then the next times it may either work, or do nothing at all, or produce error messages. If one expands the parent node first then everything works fine.

2) When placing a .js file in the scripts\auto folder the following error message appears on starting MM:
File C:\Program Files\Media Monkey\Scripts\MediaMonkey init.js cannot be open: file is not available or you don't have permissions to access it
3) I made a form with several COM UI objcts. It looks that most people can see it fine, but jmaver reports the following:
The Ok and Cancel buttons on the edit dialog are halfway over the edit field, so it makes it hard to actually see what is in there.
Last edited by Pablo on Fri Feb 04, 2005 4:36 pm, edited 1 time in total.
jmaver
Posts: 92
Joined: Thu Feb 19, 2004 10:26 am

Re: Possible bugs in the scripting system

Post by jmaver »

Pablo wrote:3) I made a form with several COM UI objcts. It looks that most people can see it fine, but jmaver reports the following:
The Ok and Cancel buttons on the edit dialog are halfway over the edit field, so it makes it hard to actually see what is in there.
This one seems to be related to the windows system theme override.
jiri
Posts: 5419
Joined: Tue Aug 14, 2001 7:00 pm
Location: Czech Republic
Contact:

Post by jiri »

1) I don't understand exactly what's wrong here, as far as I know there shouldn't be any problem. If you really think there's something wrong, please try to prepare some example code for me.

2) The file wasn't accidentally included in the installer, will be there for the next release.

3) It really doesn't work well for non-skinned version. The key is that Anchors aren't supposed to be used in non-resizable dialogs (actually, they don't have any sense there). So it's enough to remove lines:

BtnOk.Common.Anchors = 4+8 ' Right+Bottom

I'd also have one suggestion for your code, don't use:

Form.StayOnTop = True

for modal forms. Although it's possible to use, it isn't necessary because the form stays on top of application anyway.

Jiri
Pablo
Posts: 554
Joined: Sun Feb 22, 2004 2:59 am

Post by Pablo »

1) Say a script creates a node A, which has a children node B. The statement B.expanded = True will:

* Expand B if A is expanded
* Either expand A or do nothing if A is not expanded.

I'm not getting any more error messages since I installed RC-1 though.

2) Great :D

3) Thanks, you're right about the anchors. I've now (as suggested by tss) made the windows resizable anyway.
Pablo
Posts: 554
Joined: Sun Feb 22, 2004 2:59 am

Post by Pablo »

Regarding 2), something still seems to be wrong in the last build (839). If there's a onStartup function in the script, the following error message appears:
Error #5007 - Microsoft JScript runtime error
Object expected
File "C:\Program Files\MediaMonkey\Scripts\Auto\test.js", Line:1, Column:0
As a stand-alone script it runs without problems. This is the syntax I'm using:

Code: Select all

function onStartup(){
//some code
}
If there's no onStartup function, then the script is scanned for syntax errors, but even if there are no syntax errors, no code seems to be executed.

Let me know if I'm doing something wrong or there's still a bug in the implementation.

Thanks!
jiri
Posts: 5419
Joined: Tue Aug 14, 2001 7:00 pm
Location: Czech Republic
Contact:

Post by jiri »

Since JScript is case sensitive you must use the exact name of the event which is 'OnStartup'. Then it should work fine.

Jiri
Pablo
Posts: 554
Joined: Sun Feb 22, 2004 2:59 am

Post by Pablo »

Ok, I finally was able to do something with a JScript script. However, something still looks wrong. The following code works as intended:

Code: Select all

SDB.MainTree.Node_Artist.Expanded = 1
However, the following code does nothing (as expected) but no error message appears (unexpected):

Code: Select all

SDB.MainTree.Node_artist.Expanded = 1
The following does produce an error message:

Code: Select all

SDB.MainTree.Node_aartist.Expanded = 1
Furthermore, I wasn't able to display a message with SDB.MessageBox. I've tried things like

Code: Select all

var aLittleTest = SDB.MessageBox("this is a test",mtWarning,new Array(mbYes));
No error message, but nothing happens.
jiri
Posts: 5419
Joined: Tue Aug 14, 2001 7:00 pm
Location: Czech Republic
Contact:

Post by jiri »

I haven't used JScript much in past and so I can't help in this. I wonder myself if there's way to use SDB.MessageBox() function from JScript because the last parameter is an array and this kind of arrays don't seem to be possible in JScript?

Jiri
Pablo
Posts: 554
Joined: Sun Feb 22, 2004 2:59 am

Post by Pablo »

jiri wrote:I haven't used JScript much in past and so I can't help in this. I wonder myself if there's way to use SDB.MessageBox() function from JScript because the last parameter is an array and this kind of arrays don't seem to be possible in JScript?

Jiri
Indeed. I've done some google-assisted research and arrays in Jscript are definitely not intercheangeable with VBscript arrays. In environments where scripts written in both languages can coexist (i.e. web pages and wsf files) one can declare the array in VBscript and then use it in Jscript, but otherwise there's no way to call a COM object method which has an array argument from JScript :cry: .

Do you recall other COM methods which require arrays? I guess one could live without SDB.MessageBox...

I regularly program in C++ so Jscript is much more natural to me, but in terms of functionality VBscript is very similar, and M$ seems to have strongly favored VBscript to interact with COM objects, so I'll probably just stick to VBScript :-? .
jiri
Posts: 5419
Joined: Tue Aug 14, 2001 7:00 pm
Location: Czech Republic
Contact:

Post by jiri »

I can't recall any other method that needs arrays to be passed.

As for language choice, I understand that JScript is better for people used to use C++, but for scripting languages the difference is mostly in syntax only and so if you know VBScript syntax (and you definitely do) then it's probably a better choice.

Jiri
Post Reply