by rycher » Sat Nov 01, 2008 11:10 am
raybeau528 wrote:Great! How did you do it? Perhaps others could use your implementation.
Ray
Ok, so here is what I wanted: I use an auto-dj script that can insert whole albums. And when I'm in "by album" mode, I wanted to know what was the album coming up. So the script I did with your help does this: when in album mode (custom made by another script, see
http://www.mediamonkey.com/forum/viewto ... 15#p173715), when the last track of an album starts playing, it pops a window with the next album (title+artist).
This window is customized to appear just below the mini player where I use it. I didn't see how to associate it to the miniplayer, or get the miniplayer position to adjust its position accordingly. So the position and size are hard coded to my needs. Also, I don't understand why the width of the panel has to be 24 less than the width of the form, otherwise the frame of the panel doesn't appear properly (right side is outside the form). But it does.
Code: Select all
'==========================================================================
'
' MediaMonkey Script
'
' NAME: ComingUp
' DESCRIPTION:
' When playing AutoDJ by album (using script DJTiedSongsGroups), displays the next album
' on playing the last track of the previous.
'
' AUTHOR: Rycher
' DATE : 31.10.2008
'
' Thanks to raybeau528 for his help with the time-delayed window display.
'
' INSTALL:
' - Copy script to MediaMonkey's "Scripts" folder
' - Add an script entry to file Scripts.ini (example shown below)
'
' [ComingUp]
' FileName=ComingUp.vbs
' ProcName=OnSongStartsPlaying
' Order=1
' DisplayName=Coming Up...
' Description=Album coming up
' Language=VBScript
' ScriptType=2
'
'==========================================================================
Dim NextUpForm, NextUpPanel, NextUpLabel, NextUpTimer
Sub OnSongStartsPlaying
Set NextUpForm = SDB.UI.NewForm
NextUpForm.Common.Visible=False
NextUpForm.Common.ControlName=""
'NextUpForm.Common.SetRect 0,0,400,27
NextUpForm.Common.Top = 25
NextUpForm.Common.Left =492
NextUpForm.Common.Width =400
NextUpForm.Common.Height =27
NextUpForm.FormPosition = 0
NextUpForm.BorderStyle = 0
NextUpForm.StayOnTop = true
Set NextUpPanel = SDB.UI.NewPanel(NextUpForm)
NextUpPanel.Common.ControlName=""
NextUpPanel.Common.SetRect 0,0,376,27
Set NextUpLabel = SDB.UI.NewLabel(NextUpPanel)
NextUpLabel.Common.SetRect 6,6,400,27
Set NextUpTimer = SDB.CreateTimer(7000) ' 7 sec Timer
NextUpTimer.Enabled=False
Script.RegisterEvent NextUpTimer, "OnTimer", "Event_NextUpTimer"
if SDB.Player.isAutoDJ AND SDB.IniFile.BoolValue("TagGroup", "ByAlbum") AND SDB.Player.CurrentSongIndex < SDB.Player.PlaylistCount - 1 Then
dim NextUp : Set NextUp = SDB.Player.PlaylistItems(SDB.Player.CurrentSongIndex + 1)
If SDB.Player.PlaylistItems(SDB.Player.CurrentSongIndex).Album.Id <> NextUp.Album.Id Then
NextUpDisplay("Coming up : " & NextUp.AlbumName & " - " & NextUp.AlbumArtistName)
End If
End If
End Sub
Sub Event_NextUpTimer(x) ' Makes the panel invisible when the timer triggers and shuts off the timer
NextUpForm.Common.Visible=False
NextUpTimer.Enabled=False
End Sub
Sub NextUpDisplay(Msg)
NextUpTimer.Enabled=False ' Cancel any timer currently triggered
NextUpLabel.Caption=Msg ' Set the text to display
NextUpForm.Common.Visible=True
NextUpTimer.Enabled=True ' Start the timer
End Sub
The only little thing I was not able to fix is this: I set the mini player to be semi-opaque when working in another application. When the window pops with the upcoming album, it is opaque and it makes the mini player opaque, while the focus is on another application. The only way to get the mini player semi-opaque again is to switch to it and switch back to whatever application I was using. I didn't see anything to control opacity of a window through script.
If you have an idea on how to fix that let me know.
Rycher-
[quote="raybeau528"]Great! How did you do it? Perhaps others could use your implementation.
Ray[/quote]
Ok, so here is what I wanted: I use an auto-dj script that can insert whole albums. And when I'm in "by album" mode, I wanted to know what was the album coming up. So the script I did with your help does this: when in album mode (custom made by another script, see [url]http://www.mediamonkey.com/forum/viewtopic.php?f=2&t=8464&p=173715#p173715[/url]), when the last track of an album starts playing, it pops a window with the next album (title+artist).
This window is customized to appear just below the mini player where I use it. I didn't see how to associate it to the miniplayer, or get the miniplayer position to adjust its position accordingly. So the position and size are hard coded to my needs. Also, I don't understand why the width of the panel has to be 24 less than the width of the form, otherwise the frame of the panel doesn't appear properly (right side is outside the form). But it does.
[code]'==========================================================================
'
' MediaMonkey Script
'
' NAME: ComingUp
' DESCRIPTION:
' When playing AutoDJ by album (using script DJTiedSongsGroups), displays the next album
' on playing the last track of the previous.
'
' AUTHOR: Rycher
' DATE : 31.10.2008
'
' Thanks to raybeau528 for his help with the time-delayed window display.
'
' INSTALL:
' - Copy script to MediaMonkey's "Scripts" folder
' - Add an script entry to file Scripts.ini (example shown below)
'
' [ComingUp]
' FileName=ComingUp.vbs
' ProcName=OnSongStartsPlaying
' Order=1
' DisplayName=Coming Up...
' Description=Album coming up
' Language=VBScript
' ScriptType=2
'
'==========================================================================
Dim NextUpForm, NextUpPanel, NextUpLabel, NextUpTimer
Sub OnSongStartsPlaying
Set NextUpForm = SDB.UI.NewForm
NextUpForm.Common.Visible=False
NextUpForm.Common.ControlName=""
'NextUpForm.Common.SetRect 0,0,400,27
NextUpForm.Common.Top = 25
NextUpForm.Common.Left =492
NextUpForm.Common.Width =400
NextUpForm.Common.Height =27
NextUpForm.FormPosition = 0
NextUpForm.BorderStyle = 0
NextUpForm.StayOnTop = true
Set NextUpPanel = SDB.UI.NewPanel(NextUpForm)
NextUpPanel.Common.ControlName=""
NextUpPanel.Common.SetRect 0,0,376,27
Set NextUpLabel = SDB.UI.NewLabel(NextUpPanel)
NextUpLabel.Common.SetRect 6,6,400,27
Set NextUpTimer = SDB.CreateTimer(7000) ' 7 sec Timer
NextUpTimer.Enabled=False
Script.RegisterEvent NextUpTimer, "OnTimer", "Event_NextUpTimer"
if SDB.Player.isAutoDJ AND SDB.IniFile.BoolValue("TagGroup", "ByAlbum") AND SDB.Player.CurrentSongIndex < SDB.Player.PlaylistCount - 1 Then
dim NextUp : Set NextUp = SDB.Player.PlaylistItems(SDB.Player.CurrentSongIndex + 1)
If SDB.Player.PlaylistItems(SDB.Player.CurrentSongIndex).Album.Id <> NextUp.Album.Id Then
NextUpDisplay("Coming up : " & NextUp.AlbumName & " - " & NextUp.AlbumArtistName)
End If
End If
End Sub
Sub Event_NextUpTimer(x) ' Makes the panel invisible when the timer triggers and shuts off the timer
NextUpForm.Common.Visible=False
NextUpTimer.Enabled=False
End Sub
Sub NextUpDisplay(Msg)
NextUpTimer.Enabled=False ' Cancel any timer currently triggered
NextUpLabel.Caption=Msg ' Set the text to display
NextUpForm.Common.Visible=True
NextUpTimer.Enabled=True ' Start the timer
End Sub
[/code]
The only little thing I was not able to fix is this: I set the mini player to be semi-opaque when working in another application. When the window pops with the upcoming album, it is opaque and it makes the mini player opaque, while the focus is on another application. The only way to get the mini player semi-opaque again is to switch to it and switch back to whatever application I was using. I didn't see anything to control opacity of a window through script.
If you have an idea on how to fix that let me know.
Rycher-