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!
How can I use a debugger on a MM VB script?
-
- Posts: 1017
- Joined: Wed Mar 01, 2006 1:09 am
- Location: In a jungle down under
- Contact:
Just a couple of examples that I think may work.
Seems to be just the name of the field that might be the problem.
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
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.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Thanks muck, err much, to both of you...
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.
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.