INTERACT FORUM
Windows => Third Party Plug-ins, Programs, and Skins => Topic started by: simonk on December 08, 2011, 01:24:56 pm
-
I've been racking my brains but cannot see why I am unable to get a list of the Playlist names with the below code, hopefully it's just something simple that I've missed!
Public Sub Main(Optional ByVal params As String = "")
Dim mc As Object
On Error Resume Next
mc = GetObject(, "MediaJukebox Application") 'First try to get an already running object
If Debug Then hs.WriteLog("MusicSk", "GetObject Error Code = " & Err.Number)
If Err.Number = 429 Then
mc = CreateObject("MediaJukebox Application") 'Then, create a new object
End If
' Get Number Of Playlists
Dim NoPlayListsObj As Object
NoPlayListsObj = mc.GetPlayLists()
Dim NoPlayLists As Integer
NoPlayLists = NoPlayListsObj.GetNumberPlaylists()
hs.WriteLog("MusicSK", "Number Of Playlists = " & NoPlayLists)
' Get List Of Playlists
Dim PlayListObj As Object
Dim PlayListLoop As Integer
Dim PlayListName As String
For PlayListLoop = 0 To NoPlayLists
PlayListObj = mc.GetPlaylistByID(PlayListLoop)
PlayListName = PlayListObj.Name()
hs.WriteLog("MediaControl", "PlayList Number " & PlayListLoop & " Playlist Name " & PlayListName)
Next
End Sub
Thanks
Simon
-
Anyone any ideas please or a quick pointer? I've tried looked at examples but cannot see the problem!
Thanks
Simon
-
Managed to figure out what I needed to do, the code below now searches through the Playlists to find the required playlist...
Dim PlayListLoop As Integer
Dim pls As Object = mc.GetPlaylists()
Dim pl As Object
For PlayListLoop = 0 To (pls.GetNumberPlaylists() - 1)
pl = pls.GetPlaylist(PlayListLoop)
hs.WriteLog("MusicSK", "PlayList Number " & PlayListLoop & " Playlist Name '" & pl.Name & "'")
If pl.Name = "Christmas" Then
Exit For
ElseIf PlayListLoop = (pls.GetNumberPlaylists() - 1) Then
hs.WriteLog("MusicSK", "PlayList Not Found ")
Exit Sub
End If
Next