by bmeyns » Mon Nov 15, 2010 6:45 am
Based on the SilenceBetweenSongs script by Eyal, I've made a basic variant: "stop after every song"
You can enable/disable this option from the Play menu-items
Code: Select all
' Stop at end of song script v1.0
' By bmeyns, 2010.11.15 (based on SilenceBetweenSongs.vbs by Eyal)
'
' This script adds an entry in Play menu that let you
' enable/disable a default stopping at end of a song.
' Requires MediaMonkey 3.1.0.1218 or newer (?)
'
' Location: MediaMonkey\Scripts\Auto\StopAtEndOfSong.vbs
'------------------
Option Explicit
Dim AutoStopEnabled : AutoStopEnabled = True
Dim AppTitle : AppTitle = "StopAtEndOfSong"
Dim Version : Version = "1.0"
Dim MenuItem
'------------------
Sub OnStartup
InitButton
AutoStop
End Sub
Sub InitButton()
SDB.IniFile.StringValue(AppTitle,"Version") = Version '"1.0"
If Not SDB.IniFile.ValueExists(AppTitle,"Enabled") Then
SDB.IniFile.BoolValue(AppTitle,"Enabled") = AutoStopEnabled
End If
AutoStopEnabled = SDB.IniFile.BoolValue(AppTitle,"Enabled")
Set MenuItem = SDB.UI.AddMenuItem(SDB.UI.Menu_Play,4,1)
MenuItem.Caption = "Auto-stop *"
Script.RegisterEvent MenuItem, "OnClick", "ToggleAutoStop"
MenuItem.Visible = True
MenuItem.Checked = AutoStopEnabled
' Child of [Player] in the options:
SDB.UI.AddOptionSheet "Auto-stop", Script.ScriptPath, "InitSheet", "SaveSheet", -2
End Sub
'------------------
Sub ToggleAutoStop(p)
AutoStopEnabled = Not AutoStopEnabled
MenuItem.Checked = AutoStopEnabled
SDB.IniFile.BoolValue(AppTitle,"Enabled") = AutoStopEnabled
If AutoStopEnabled then
SDB.IniFile.BoolValue(AppTitle,"CrossfadeState") = SDB.Player.IsCrossfade
SDB.Player.IsCrossfade = False
Else
SDB.Player.IsCrossfade = SDB.IniFile.BoolValue(AppTitle,"CrossfadeState")
End If
AutoStop
End Sub
Sub AutoStop
If AutoStopEnabled Then
Script.RegisterEvent SDB, "OnPlay", "PlayerOnPlay"
'--Script.RegisterEvent SDB, "OnTrackEnd", "PlayerTrackEnd"
Else
Script.UnregisterEvents SDB
SDB.Player.StopAfterCurrent = False
End If
End Sub
'------------------
Sub PlayerOnPlay()
If AutoStopEnabled Then
SDB.Player.StopAfterCurrent = True
End If
End Sub
'---------------------
Sub InitSheet(Sheet)
Dim oPanel1, oCheck1
Set oPanel1 = SDB.UI.NewGroupBox(Sheet)
oPanel1.Common.SetRect 100,80,240,50
oPanel1.Caption = "Auto-stop"
With SDB.UI.NewLabel(Sheet)
.Common.Left = 460
.Common.Top = 5
.Caption = "v" & Version
End With
With SDB.UI.NewLabel(Sheet)
.Alignment = 2 'Center
.Common.SetRect 100,30,100,40
.Caption = "Automatically stops at the end of every song"
End With
Set oCheck1 = SDB.UI.NewCheckBox(oPanel1)
With oCheck1
.Caption = "Enable"
.Common.Left = 25
.Common.Top = 25
.Common.ControlName = "ChEnable"
.Checked = AutoStopEnabled
End With
End Sub
'---------------------
Sub SaveSheet(Sheet)
Dim v
Set v = Sheet.Common.ChildControl("ChEnable")
If v.Checked <> AutoStopEnabled then
ToggleAutoStop 0
End If
SDB.IniFile.BoolValue(AppTitle,"Enabled") = AutoStopEnabled 'Not necessary????
End Sub
Based on the SilenceBetweenSongs script by Eyal, I've made a basic variant: "stop after every song"
You can enable/disable this option from the Play menu-items
[code]
' Stop at end of song script v1.0
' By bmeyns, 2010.11.15 (based on SilenceBetweenSongs.vbs by Eyal)
'
' This script adds an entry in Play menu that let you
' enable/disable a default stopping at end of a song.
' Requires MediaMonkey 3.1.0.1218 or newer (?)
'
' Location: MediaMonkey\Scripts\Auto\StopAtEndOfSong.vbs
'------------------
Option Explicit
Dim AutoStopEnabled : AutoStopEnabled = True
Dim AppTitle : AppTitle = "StopAtEndOfSong"
Dim Version : Version = "1.0"
Dim MenuItem
'------------------
Sub OnStartup
InitButton
AutoStop
End Sub
Sub InitButton()
SDB.IniFile.StringValue(AppTitle,"Version") = Version '"1.0"
If Not SDB.IniFile.ValueExists(AppTitle,"Enabled") Then
SDB.IniFile.BoolValue(AppTitle,"Enabled") = AutoStopEnabled
End If
AutoStopEnabled = SDB.IniFile.BoolValue(AppTitle,"Enabled")
Set MenuItem = SDB.UI.AddMenuItem(SDB.UI.Menu_Play,4,1)
MenuItem.Caption = "Auto-stop *"
Script.RegisterEvent MenuItem, "OnClick", "ToggleAutoStop"
MenuItem.Visible = True
MenuItem.Checked = AutoStopEnabled
' Child of [Player] in the options:
SDB.UI.AddOptionSheet "Auto-stop", Script.ScriptPath, "InitSheet", "SaveSheet", -2
End Sub
'------------------
Sub ToggleAutoStop(p)
AutoStopEnabled = Not AutoStopEnabled
MenuItem.Checked = AutoStopEnabled
SDB.IniFile.BoolValue(AppTitle,"Enabled") = AutoStopEnabled
If AutoStopEnabled then
SDB.IniFile.BoolValue(AppTitle,"CrossfadeState") = SDB.Player.IsCrossfade
SDB.Player.IsCrossfade = False
Else
SDB.Player.IsCrossfade = SDB.IniFile.BoolValue(AppTitle,"CrossfadeState")
End If
AutoStop
End Sub
Sub AutoStop
If AutoStopEnabled Then
Script.RegisterEvent SDB, "OnPlay", "PlayerOnPlay"
'--Script.RegisterEvent SDB, "OnTrackEnd", "PlayerTrackEnd"
Else
Script.UnregisterEvents SDB
SDB.Player.StopAfterCurrent = False
End If
End Sub
'------------------
Sub PlayerOnPlay()
If AutoStopEnabled Then
SDB.Player.StopAfterCurrent = True
End If
End Sub
'---------------------
Sub InitSheet(Sheet)
Dim oPanel1, oCheck1
Set oPanel1 = SDB.UI.NewGroupBox(Sheet)
oPanel1.Common.SetRect 100,80,240,50
oPanel1.Caption = "Auto-stop"
With SDB.UI.NewLabel(Sheet)
.Common.Left = 460
.Common.Top = 5
.Caption = "v" & Version
End With
With SDB.UI.NewLabel(Sheet)
.Alignment = 2 'Center
.Common.SetRect 100,30,100,40
.Caption = "Automatically stops at the end of every song"
End With
Set oCheck1 = SDB.UI.NewCheckBox(oPanel1)
With oCheck1
.Caption = "Enable"
.Common.Left = 25
.Common.Top = 25
.Common.ControlName = "ChEnable"
.Checked = AutoStopEnabled
End With
End Sub
'---------------------
Sub SaveSheet(Sheet)
Dim v
Set v = Sheet.Common.ChildControl("ChEnable")
If v.Checked <> AutoStopEnabled then
ToggleAutoStop 0
End If
SDB.IniFile.BoolValue(AppTitle,"Enabled") = AutoStopEnabled 'Not necessary????
End Sub
[/code]