Auto-stop (stop at end of every song)

Download and get help for different MediaMonkey for Windows 4 Addons.

Moderators: Peke, Gurus

bmeyns
Posts: 2
Joined: Mon Nov 15, 2010 6:35 am

Auto-stop (stop at end of every song)

Post by bmeyns »

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
Peke
Posts: 17484
Joined: Tue Jun 10, 2003 7:21 pm
Location: Earth
Contact:

Re: Auto-stop (stop at end of every song)

Post by Peke »

Nice Script, simple but useful.
Best regards,
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
Image
Image
Image
How to attach PICTURE/SCREENSHOTS to forum posts
Guest

Re: Auto-stop (stop at end of every song)

Post by Guest »

Does this work in V4. I installed it and now all files stop.

Thanks
MMFrLife
Posts: 2894
Joined: Fri Oct 26, 2012 9:04 pm
Location: MM Forum

Re: Auto-stop (stop at end of every song)

Post by MMFrLife »

Guest wrote:Does this work in V4. I installed it and now all files stop.

Thanks
I have no problem using it with 4.1.9.1764 portable
MM user since 2003 (lifetime lic. 2012) "Trying to imagine life without music gives me a headache"
Top 2 scripts: RegExp Find & Replace (e.v.) and Magic Nodes (e.v.) ZvezdanD's scripts site
Please take a moment to read the bottom of the linked page to support the one and only - ZvezdanD! (the "originator" since 2006).
MMW 4.1.31.1919; 5.0.4.2690 || back it up...frequently!
|| software for power users: "Q-Dir" (free alt. to explorer) and file/folder renamer: "ReNamer" (den4b)
"The absurd is the essential concept and the first truth"
😜
Babsi

Re: Auto-stop (stop at end of every song)

Post by Babsi »

Hi,

I am a dance instructor and had to switch to a new device, and the new iTunes doesn't allow this feature anymore, so I was directed here. I need to be able for each song to stop, and I don't want to have to remember to press "stop after current" each time.

I have never done an add-on script and don't know anything about coding or inserting code language. What exactly do I do with the code you provided? I would appreciate exact instructions for dummies, thank you :)
Peke
Posts: 17484
Joined: Tue Jun 10, 2003 7:21 pm
Location: Earth
Contact:

Re: Auto-stop (stop at end of every song)

Post by Peke »

Hi,
Here it is:
1. Open Notepad
2. In first post click on Select ALL -> Right click on any part of selected text -> Copy
3. Go to notepad
4. Right click on empty space -> Paste
5. File Save
6. navigate to MMW install folder eg. "C:\Program Files (x86)\MediaMonkey\Scripts\Auto\"
7. Enter Save name "SilenceBetweenSongs.vbs" and save file
8. Restart MMW and under Play menu you should have New Option. Also under Tools -> Options you can set its settings.
Best regards,
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
Image
Image
Image
How to attach PICTURE/SCREENSHOTS to forum posts
Babsi

Re: Auto-stop (stop at end of every song)

Post by Babsi »

Hi,

Thank you. Unfortunately, I need even more basic instructions. I don't know how to open Notepad. I don't see it on my computer. Is this something I need to download?

And where do I find the MMW install folder? How do I get there?

Thanks so much.
Lowlander
Posts: 56570
Joined: Sat Sep 06, 2003 5:53 pm
Location: MediaMonkey 5

Re: Auto-stop (stop at end of every song)

Post by Lowlander »

Notepad should already be installed on your PC as it comes with Windows. Open Start Menu and type notepad.

The install folder is where you installed MediaMonkey. Check C:\Program Files (x86)\MediaMonkey or C:\Program Files\MediaMonkey
Erwin Hanzl
Posts: 1189
Joined: Tue Jun 13, 2017 8:47 am
Location: Vienna

Re: Auto-stop (stop at end of every song)

Post by Erwin Hanzl »

It's great - the Script works correctly.

Filename: SilenceBetweenSongs.vbs
Location: %appdata%\MediaMonkey\Scripts\Auto\SilenceBetweenSongs.vbs
No entry in Scripts.ini
MMW 4.1.31.1919 Gold-Standardinstallation
MarcLister
Posts: 28
Joined: Wed Aug 05, 2020 8:34 am

Re: Auto-stop (stop at end of every song)

Post by MarcLister »

Is it possible to alter this code to make it stop at the end of each album? I often listen to an album and have a few on the playlist album to follow on. I'd like to be able to get MM to stop at the end of an album so that I have to then resume play to get the next album starting and then again at the end of that album etc.
Peke
Posts: 17484
Joined: Tue Jun 10, 2003 7:21 pm
Location: Earth
Contact:

Re: Auto-stop (stop at end of every song)

Post by Peke »

Hi,
Yes it should be possible if you compare album value of next track with one that is currently playing and stop if differs.
Best regards,
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
Image
Image
Image
How to attach PICTURE/SCREENSHOTS to forum posts
Erwin Hanzl
Posts: 1189
Joined: Tue Jun 13, 2017 8:47 am
Location: Vienna

Re: Auto-stop (stop at end of every song)

Post by Erwin Hanzl »

Hello Marc,
no script is necessary for this.

Image
MMW 4.1.31.1919 Gold-Standardinstallation
Post Reply