player.playlistaddtracks not working???

This forum is for questions / discussions regarding development of addons / tweaks for MediaMonkey.

Moderator: Gurus

Phik
Posts: 2
Joined: Fri Aug 07, 2009 9:20 pm

player.playlistaddtracks not working???

Post by Phik » Sat Oct 24, 2009 6:53 pm

Hey, im new here, so thanks for putting up with any dumb questions that may pop up... i've been making a program to allow me to control my music on my desktop with my laptop, but im having some trouble with player.playlistaddtracks object. ive created a songlist object and populated it with a song query. but here's the kicker. when i got to put a new playlist in the now playing with the player.playlistaddtracks, it goes "object doesnt support this property or method".
here's the code im using:

Code: Select all

    
    Dim i As Integer
    Dim search As String
    Set list = SDB.NewSongList

    ReDim songs(0)
    search = "'" & artists(artistList.ListIndex + 1) & "'"
    Set iterSong = SDB.Database.QuerySongs("Artist = " & search)
    SDB.player.playlistclear
    Do While Not iterSong.EOF
        list.Add (iterSong.Item)
        iterSong.Next
    Loop

    SDB.player.PlaylistAddTracks (list) 'this is in a different function, hence why i just dont populate the playlist in the while loop.
its got me righty baffled...
ive been programming for a while, but this is really the first time i've used the MM object and i've been using the Wiki extensivly, but that doesnt shed any light on my problem...
thanks for you help :D

trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Re: player.playlistaddtracks not working???

Post by trixmoto » Mon Oct 26, 2009 5:48 am

Try...

Code: Select all

Call SDB.Player.PlaylistAddTracks (list)
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.

Phik
Posts: 2
Joined: Fri Aug 07, 2009 9:20 pm

Re: player.playlistaddtracks not working???

Post by Phik » Mon Oct 26, 2009 11:43 pm

you sir, are a genius.
Many thanks, worked a charm. not quite sure why it needs call while all other function call's dont...oh well, it works.

trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Re: player.playlistaddtracks not working???

Post by trixmoto » Tue Oct 27, 2009 4:54 am

Thanks! :D

You don't need to "call" functions or properties, but you do need to "call" sub procedures if you are going to use brackets. I believe you can either use...

Code: Select all

SDB.player.PlaylistAddTracks list

'or

Call SDB.player.PlaylistAddTracks (list)
...but I prefer to always use "call" personally.
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