by raybeau528 » Sun Apr 05, 2009 7:02 pm
@jkforde - I think this little script might do what you're looking for. Extract and copy to scripts\auto\playnext.vbs.
Let me know if it works for you and if so I'll make an install package for it.
To use, right click on a track in the track list window and select Play Next! It will place the selected track after the current playing track in now playing. If shuffle is on it will temporarily turn it off. When the next track (the one you clicked on to play next) starts playing it will turn shuffle back on.
Edit: Addressed the second part of your request to set the Next track in the now playing window (assuming I understood correctly). When you select a track in the Now Playing window and right-click on Play Next!, that track will be played next regardless if Shuffle is on or off. If it's on, it will turn it off temporarily and turn it back on when the next track starts playing.
Edit: Update addresses a couple issues with shuffle state changes.
Ray
Code: Select all
'
' MediaMonkey Script
'
' NAME: PlayNext
'
'
' [PlayNext]
' FileName=PlayNext.vbs
' ProcName=PlayNext
' Order=210
' DisplayName=Play Next!
' Description=Play Next
' Language=VBScript
' ScriptType=0
'
'
Option Explicit
Sub OnStartup 'Create PlayNext Menu Item
Dim itm1
Set itm1 = SDB.UI.AddMenuItem(SDB.UI.Menu_Pop_TrackList,0,0)
itm1.Caption = "Play Next!"
itm1.UseScript = Script.ScriptPath
itm1.IconIndex = 18
itm1.Visible = True
Script.RegisterEvent itm1, "OnClick","Event_TrackListPlayNext"
Set itm1 = SDB.UI.AddMenuItem(SDB.UI.Menu_Pop_NP,0,0)
itm1.Caption = "Play Next!"
itm1.UseScript = Script.ScriptPath
itm1.IconIndex = 18
itm1.Visible = True
Script.RegisterEvent itm1, "OnClick","Event_NowPlayingPlayNext"
SDB.IniFile.BoolValue("PlayNext","ShuffleState") = SDB.Player.isShuffle
'Script.RegisterEvent SDB, "OnShuffleClicked", "Event_ShuffleClicked"
End Sub 'OnStartup
Sub Event_TrackListPlayNext( arg )
Dim i
Script.UnRegisterEvents SDB
Script.RegisterEvent SDB, "OnShuffleClicked", "Event_ShuffleClicked"
If SDB.Player.isShuffle Then
SDB.IniFile.BoolValue("PlayNext","ShuffleState") = True
SDB.IniFile.BoolValue("PlayNext","ShuffleClicked") = True
SDB.Player.isShuffle = False
End If
Dim otrack : Set oTrack = SDB.CurrentSongList.Item(0)
Dim oPlayerTracks : Set oPlayerTracks = SDB.Player.CurrentSongList
Dim oRemainderTracks : Set oRemainderTracks = SDB.NewSongList
SDB.IniFile.IntValue("PlayNext","NextTrack") = SDB.Player.CurrentSongIndex +1
For i = SDB.Player.CurrentSongIndex +1 to oPlayerTracks.Count-1
oRemainderTracks.Add ( oPlayerTracks.Item(i) )
SDB.Player.PlayListDelete(SDB.Player.CurrentSongIndex +1)
Next
SDB.Player.PlayListAddTrack( oTrack )
SDB.Player.PlayListAddTracks( oRemainderTracks )
Script.RegisterEvent SDB, "OnPlayBackEnd","Event_OnPlayBackEnd"
End Sub
Sub Event_NowPlayingPlayNext( arg )
Dim i
Script.UnRegisterEvents SDB
Script.RegisterEvent SDB, "OnShuffleClicked", "Event_ShuffleClicked"
If SDB.Player.isShuffle Then
SDB.IniFile.BoolValue("PlayNext","ShuffleState") = True
SDB.IniFile.BoolValue("PlayNext","ShuffleClicked") = True
SDB.Player.isShuffle = False
End If
Dim otrack : Set oTrack = SDB.CurrentSongList.Item(0)
Dim oPlayerTracks : Set oPlayerTracks = SDB.Player.CurrentSongList
For i = 0 to oPlayerTracks.Count -1
If oPlayerTracks.Item(i).ID = oTrack.ID Then
Exit For
End IF
Next
SDB.IniFile.IntValue("PlayNext","NextTrack") = i
Script.RegisterEvent SDB, "OnPlayBackEnd","Event_OnPlayBackEnd"
End Sub
Sub Event_OnPlayBackEnd()
Script.UnRegisterEvents SDB
Script.RegisterEvent SDB, "OnShuffleClicked", "Event_ShuffleClicked"
SDB.Player.STop
Script.RegisterEvent SDB, "OnPlay","Event_Play"
SDB.Player.Play
End Sub
Sub Event_Play()
Script.UnRegisterEvents SDB
Script.RegisterEvent SDB, "OnShuffleClicked", "Event_ShuffleClicked"
SDB.Player.CurrentSongIndex = SDB.IniFile.IntValue("PlayNext","NextTrack")
SDB.IniFile.BoolValue("PlayNext","ShuffleClicked") = True
SDB.Player.isShuffle = SDB.IniFile.BoolValue("PlayNext","ShuffleState")
End Sub
Sub Event_ShuffleClicked()
If Not SDB.IniFile.BoolValue("PlayNext","ShuffleClicked") Then
SDB.IniFile.BoolValue("PlayNext","ShuffleState") = SDB.Player.isShuffle ' User clicked
Else
SDB.IniFile.BoolValue("PlayNext","ShuffleClicked") = False ' Expected
End If
End Sub
@jkforde - I think this little script might do what you're looking for. Extract and copy to scripts\auto\playnext.vbs.
Let me know if it works for you and if so I'll make an install package for it.
To use, right click on a track in the track list window and select Play Next! It will place the selected track after the current playing track in now playing. If shuffle is on it will temporarily turn it off. When the next track (the one you clicked on to play next) starts playing it will turn shuffle back on.
Edit: Addressed the second part of your request to set the Next track in the now playing window (assuming I understood correctly). When you select a track in the Now Playing window and right-click on Play Next!, that track will be played next regardless if Shuffle is on or off. If it's on, it will turn it off temporarily and turn it back on when the next track starts playing.
Edit: Update addresses a couple issues with shuffle state changes.
Ray
[code] '
' MediaMonkey Script
'
' NAME: PlayNext
'
'
' [PlayNext]
' FileName=PlayNext.vbs
' ProcName=PlayNext
' Order=210
' DisplayName=Play Next!
' Description=Play Next
' Language=VBScript
' ScriptType=0
'
'
Option Explicit
Sub OnStartup 'Create PlayNext Menu Item
Dim itm1
Set itm1 = SDB.UI.AddMenuItem(SDB.UI.Menu_Pop_TrackList,0,0)
itm1.Caption = "Play Next!"
itm1.UseScript = Script.ScriptPath
itm1.IconIndex = 18
itm1.Visible = True
Script.RegisterEvent itm1, "OnClick","Event_TrackListPlayNext"
Set itm1 = SDB.UI.AddMenuItem(SDB.UI.Menu_Pop_NP,0,0)
itm1.Caption = "Play Next!"
itm1.UseScript = Script.ScriptPath
itm1.IconIndex = 18
itm1.Visible = True
Script.RegisterEvent itm1, "OnClick","Event_NowPlayingPlayNext"
SDB.IniFile.BoolValue("PlayNext","ShuffleState") = SDB.Player.isShuffle
'Script.RegisterEvent SDB, "OnShuffleClicked", "Event_ShuffleClicked"
End Sub 'OnStartup
Sub Event_TrackListPlayNext( arg )
Dim i
Script.UnRegisterEvents SDB
Script.RegisterEvent SDB, "OnShuffleClicked", "Event_ShuffleClicked"
If SDB.Player.isShuffle Then
SDB.IniFile.BoolValue("PlayNext","ShuffleState") = True
SDB.IniFile.BoolValue("PlayNext","ShuffleClicked") = True
SDB.Player.isShuffle = False
End If
Dim otrack : Set oTrack = SDB.CurrentSongList.Item(0)
Dim oPlayerTracks : Set oPlayerTracks = SDB.Player.CurrentSongList
Dim oRemainderTracks : Set oRemainderTracks = SDB.NewSongList
SDB.IniFile.IntValue("PlayNext","NextTrack") = SDB.Player.CurrentSongIndex +1
For i = SDB.Player.CurrentSongIndex +1 to oPlayerTracks.Count-1
oRemainderTracks.Add ( oPlayerTracks.Item(i) )
SDB.Player.PlayListDelete(SDB.Player.CurrentSongIndex +1)
Next
SDB.Player.PlayListAddTrack( oTrack )
SDB.Player.PlayListAddTracks( oRemainderTracks )
Script.RegisterEvent SDB, "OnPlayBackEnd","Event_OnPlayBackEnd"
End Sub
Sub Event_NowPlayingPlayNext( arg )
Dim i
Script.UnRegisterEvents SDB
Script.RegisterEvent SDB, "OnShuffleClicked", "Event_ShuffleClicked"
If SDB.Player.isShuffle Then
SDB.IniFile.BoolValue("PlayNext","ShuffleState") = True
SDB.IniFile.BoolValue("PlayNext","ShuffleClicked") = True
SDB.Player.isShuffle = False
End If
Dim otrack : Set oTrack = SDB.CurrentSongList.Item(0)
Dim oPlayerTracks : Set oPlayerTracks = SDB.Player.CurrentSongList
For i = 0 to oPlayerTracks.Count -1
If oPlayerTracks.Item(i).ID = oTrack.ID Then
Exit For
End IF
Next
SDB.IniFile.IntValue("PlayNext","NextTrack") = i
Script.RegisterEvent SDB, "OnPlayBackEnd","Event_OnPlayBackEnd"
End Sub
Sub Event_OnPlayBackEnd()
Script.UnRegisterEvents SDB
Script.RegisterEvent SDB, "OnShuffleClicked", "Event_ShuffleClicked"
SDB.Player.STop
Script.RegisterEvent SDB, "OnPlay","Event_Play"
SDB.Player.Play
End Sub
Sub Event_Play()
Script.UnRegisterEvents SDB
Script.RegisterEvent SDB, "OnShuffleClicked", "Event_ShuffleClicked"
SDB.Player.CurrentSongIndex = SDB.IniFile.IntValue("PlayNext","NextTrack")
SDB.IniFile.BoolValue("PlayNext","ShuffleClicked") = True
SDB.Player.isShuffle = SDB.IniFile.BoolValue("PlayNext","ShuffleState")
End Sub
Sub Event_ShuffleClicked()
If Not SDB.IniFile.BoolValue("PlayNext","ShuffleClicked") Then
SDB.IniFile.BoolValue("PlayNext","ShuffleState") = SDB.Player.isShuffle ' User clicked
Else
SDB.IniFile.BoolValue("PlayNext","ShuffleClicked") = False ' Expected
End If
End Sub
[/code]