How can I use a debugger on a MM VB script?

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

Moderators: Peke, Gurus

Jared
Posts: 10
Joined: Wed Feb 14, 2007 11:19 am

How can I use a debugger on a MM VB script?

Post by Jared »

I cloned the SwapArtistTitle script into one called SwapAlbumTitle and everywhere changed "Artist" to "Album". Then I installed it in scripts.ini and mediamonkey\scripts. Simple project to get my feet wet, right?

After starting MM, I selected a line, ran the "SwapArtistTitle" script on it twice, just to prove that I had the environment/operation correct.

Then I tried my cloned SwapAlbumTitle script, which popped up a message box about type mismatch. The source file named was my script.

I have the Visual Studio Express versions of VB and C++ and WD installed. (I also have VS 6 from a few years back on my shelf). What I want to happen is, instead of the message box appearing, that my script will open up in VB at the point of error where I can look at objects, step through execution, etc.

How do I make a debugger get control when the script errors?

(And BTW, the message was "Type Mismatch: itm.Title" on the line "itm.Title = itm.Album". I would ass/u/me that the types of Album and Artist would be the same, both strings.... So any idea what's wrong?)

Thanks!
DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo »

Just a couple of examples that I think may work.

Code: Select all

Set list = SDB.CurrentSongList
        For i=0 To list.count-1
             Set itm=list.item(i)
             tmp=itm.AlbumName
                 itm.AlbumName=itm.ArtistName
                 itm.ArtistName=tmp
                 itm.UpdateAlbum
                 itm.UpdateArtist
        Next
    list.UpdateAll
'----------
Set list = SDB.CurrentSongList
        For i=0 To list.count-1
             Set itm=list.item(i)
             tmp=itm.AlbumArtistName
                 itm.AlbumName=itm.AlbumArtistName
                 itm.AlbumArtistName=tmp
                 itm.UpdateAlbum
                 itm.UpdateArtist
        Next
    list.UpdateAll
Seems to be just the name of the field that might be the problem.
Image
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

Well I don't know about debugging, but I can tell you what the problem is - "itm.Title" is a String variant and "itm.Album" is a SDBAlbum object, therefore you cannot make one equal the other. Try...

Code: Select all

itm.Title = itm.AlbumName
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.
Jared
Posts: 10
Joined: Wed Feb 14, 2007 11:19 am

Thanks muck, err much, to both of you...

Post by Jared »

1 -- You're right about the names. One alligator killed!

2 -- When I get some more time to read the MSDN materials, I'll make a try at draining the swamp. If I ever see dry land, I'll post again.
Post Reply