Call the script Checker.vbs
Once you start either script then the checker will go into action and continue the same script indefinately unless you run across the unlikely event of an album with only 2 songs in PlayAlbum mode.
If there is any better way of accomplishing these tasks or other suggestions, please reply.
Code: Select all
Sub Checker
Set plr=SDB.Player
If (((plr.PlaylistCount) = (plr.CurrentSongIndex +1)) and (plr.PlaylistCount>3))Then
Call PlayAlbum
Else If (((plr.PlaylistCount) = (plr.CurrentSongIndex +1)) and (plr.PlaylistCount<=3)) Then
Call PlayArtist
End If
End If
End Sub
Sub PlayAlbum
Dim list, itm, i, a, b, c
' Set List
Set list = SDB.AllVisibleSonglist
If list.count=0 Then
res = SDB.MessageBox( "Select Tracks to be exported, please.", mtInformation, Array(mbOk))
Exit Sub
End If
Set plr=SDB.Player
plr.PlaylistClear
Dim Progress
Set Progress = SDB.Progress
Progress.Text = "Working..."
'Export to MM all songs
Progress.MaxValue = list.count
Randomize
i=0
i = Int(((list.count-1) * Rnd) + 1)
Set itm = list.Item(i)
a = itm.AlbumName
For b=0 to list.count-1
Set itm=list.item(b)
If itm.AlbumName = a Then
plr.PlaylistAddTrack(itm)
Progress.Value=b+1
If Progress.Terminate Then
Exit For
End If
End If
Next
For c=0 to list.count-1
Set itm=list.item(c)
If itm.Title="End" Then
plr.PlaylistAddTrack(itm)
End If
Next
plr.Play
End Sub
Sub PlayArtist
Dim list, itm, i, a, b, c, d
' Set List
Set list = SDB.AllVisibleSonglist
If list.count=0 Then
res = SDB.MessageBox( "Select Tracks to be exported, please.", mtInformation, Array(mbOk))
Exit Sub
End If
Set plr=SDB.Player
plr.PlaylistClear
Dim Progress
Set Progress = SDB.Progress
Progress.Text = "Working..."
'Export to MM all songs
Progress.MaxValue = list.count
Randomize
i=0
i = Int(((list.count-1) * Rnd) + 1)
Set itm = list.Item(i)
a = itm.ArtistName
For b=0 to list.count-1
d=Int(((list.count-1) * Rnd) + 1)
Set itm=list.item(d)
If itm.ArtistName = a Then
If plr.PlaylistCount<2 Then
plr.PlaylistAddTrack(itm)
Progress.Value=b+1
If Progress.Terminate Then
Exit For
End If
End If
End If
Next
For c=0 to list.count-1
Set itm=list.item(c)
If itm.Title="End" Then
plr.PlaylistAddTrack(itm)
End If
Next
plr.Play
End Sub
Code: Select all
[PlayAlbum]
FileName=Checker.vbs
ProcName=PlayAlbum
Order=1
DisplayName=Play Full Album
Description=Plays Full Album
Language=VBScript
ScriptType=0
[Checker]
FileName=Checker.vbs
ProcName=Checker
Order=1
DisplayName=Checker
Description=Checker
Language=VBScript
ScriptType=2
[PlayArtist]
FileName=Checker.vbs
ProcName=PlayArtist
Order=2
DisplayName=Play Artist
Description=Plays Artist
Language=VBScript
ScriptType=0