Page 1 of 5

Resume Play or Pause at MM start-up v2.2/3.1 [Script]

Posted: Wed May 24, 2006 9:42 pm
by DiddeLeeDoo
Resume Pause or Play at startup of MediaMonkey

If you left a song playing when MediaMonkey closed, it will resume playing if you start MediaMonkey within a timeout period set for 30 minutes, otherwise song will be paused at the position you left it.

==============================================
MediaMonkey v2.5

Changelog:
2.10 - 2.20 : Tuned up to do as little as possible (12 December 2006)

Install ResumePlay for MM 2.5
Open zip, and just double click the install file.

Uninstall = Remove file \Program Files\MediaMonkey\Scripts\Auto\ResumePlay.vbs

==============================================
MediaMonkey v3.0

Changelog:
3.0 Added delay timer due to slow reaction from MM3
3.1 Replaced delay timer with dynamic timer, to allow for various delay needs.

Install ResumePlay for MM 3.0

==============================================


The timeout period can be set in this line in the script

Code: Select all

TimeOut=30 'in Minutes

Code: Select all

'---------------------------------------------------------------
' \Program Files\MediaMonkey\Scripts\Auto\ResumePlay.vbs
'
' Version: 3.1 
' Date: 7 January 2008
' By DiddeLeeDoo
'---------------------------------------------------------------
Sub OnStartUp
    Set TMR=SDB.CreateTimer(100)
    With SDB.Registry
        If .OpenKey("Resume Play", False) Then
            If  .BoolValue("Unfinished") Then
                .BoolValue("Unfinished")=False
                If .BoolValue("Played") And _
                    DateDiff("s",Now,.StringValue("TimeOut"))>0 Then
                    SDB.Player.Play
                    Script.RegisterEvent TMR, "OnTimer","WasPlaying" 
                Else
                    SDB.Player.Play
                    Script.RegisterEvent TMR, "OnTimer","WasPaused" 
                End If
            End If
           .CloseKey
        End If
    End With
    Script.RegisterEvent SDB,"OnShutdown","CheckPlaying"
End Sub

Sub WasPlaying(TMR)
    With SDB.Registry
        If .OpenKey("Resume Play", False) Then
         x=.IntValue("StoppedAt")
            SDB.Player.PlayBackTime=x
            
           .CloseKey
        End If
    End With
    If SDB.Player.PlayBackTime=>x Then Script.UnregisterEvents TMR
End Sub

Sub WasPaused(TMR)
    With SDB.Registry
        If .OpenKey("Resume Play", False) Then
         x=.IntValue("StoppedAt")
            SDB.Player.PlayBackTime=x
            SDB.Player.Pause
           .CloseKey
        End If
    End With
    If SDB.Player.PlayBackTime=>x Then Script.UnregisterEvents TMR
End Sub

Sub CheckPlaying
    If  SDB.Player.isPlaying Then
        Played=Not SDB.Player.isPaused
        TimeOut=30 'in Minutes
        With SDB.Registry
            If .OpenKey("Resume Play", True) Then
               .BoolValue("Unfinished")=True
               .BoolValue("Played")    =Played
               .IntValue("StoppedAt")  =SDB.Player.PlaybackTime
               .StringValue("TimeOut") =DateAdd("n",TimeOut,Now)
               .CloseKey
            End If
        End With
    End If
End Sub

Posted: Thu May 25, 2006 3:19 am
by trixmoto
Nice simple script - I like it!

I also like the fact that you use the registry. At first I thought this was bad because my MM is installed on an external harddrive so each computer I used it on would start from the last place that computer was. But as the Now Playing list is stored individually on each computer, this actually works perfectly! :)

Posted: Thu May 25, 2006 5:37 am
by westis
Thanks indeed! Works great! :)

Posted: Sat May 27, 2006 8:40 am
by Steegy
It would be nice if this script is put in the TweakMonkey script.
(see http://www.mediamonkey.com/forum/viewto ... 3930#43930 and next)

At least, that's my philosophy too (many of my old "scripts" are now integrated in the TweakMonkey script :cry: :D (mixed feeling)).

If Teknojnky is nice (and he usually is :P), he should put your name together with the piece of code, if that would be an issue.

Cheers
Steegy

Posted: Sat May 27, 2006 10:53 am
by DiddeLeeDoo
Thank you for your comment on that. I already use an improved version of this script, but haven't bothered posting it here yet.

Hopefully over time the scripting ‘bank’ will have an improved layout in order to make it more attractive to do contributions.

Posted: Sat May 27, 2006 11:10 pm
by DiddeLeeDoo
Just a little note about that I changed the Script Page above. Now when I feel I have a script I can nurture, and look after.

I improved it by adding a Timeout period for Resume Play at start-up.

Posted: Sun May 28, 2006 2:27 am
by DiddeLeeDoo
Just another note, since I try to keep the script at the beginning of this thread.

Added Fade-In to the script too... so now I start to feel it's more a complete stand alone script.

Posted: Sun May 28, 2006 5:29 am
by Steegy
Nice, nice, nice. A must-have for my collection :D.

One remark: please make the "Fade-In" optional (so it can be enabled/disabled in the beginning of the script, as also the timeout can be set). This is because my output plugin already does the fading in, so I don't want the script to do it too.

BTW: I already had a fading-in idea for the "tts sa". But maybe the fading period there is to short to notice. (and I thought the fast volume changing would take "too much" performance)

Cheers
Steegy

Posted: Sun May 28, 2006 7:34 am
by DiddeLeeDoo
I thought this 1.2 seconds with fade-in should not be that much of a big problem as several conditions have to be met for it to actually start playing and fading in.

Firstly you have to close MediaMonkey when a song is playing. Secondly you have to restart MediaMonkey within half an hour for the fade-in and play starts. Otherwise the script do nothing at all.

But it's easy to make options, and I'm thinking about another feature too, so I'll include that in next version.

Posted: Sun May 28, 2006 8:07 pm
by Teknojnky
Ok, I can't seem to see where the initial registry key is set.

"Resume Play" ???

How does this ever get set "True"?

edit:

Nevermind, I think I understand now, "Resume Play" is the key, the other things are values under the key.

"Resume Play" is always true if windows can open or create it (I am assuming).

Posted: Sun May 28, 2006 9:10 pm
by DiddeLeeDoo
I saw you already have some volume control in your script Teknojnky, or is it Steegy's script? Steegy have mentioned the value of keeping things separate, and I agree with that.

I would find it confusing if all of Trixmoto's scripts were in TweakMonkey too for example.

To some extent you leave me feeling like a bird laying eggs, and you collect the eggs. I feel this take away my motivation for laying eggs and nurture them, as it is after all it is a totally voluntaire thing to do.

I try to do things that’s not done before, which makes this forum of limited value to me in regards to finding how to do things.

Hopefully the future ‘Easy Find & Install Script’ will reduce the need for an ‘All in One’ script, which I know you’re motivated for.

This is not meant as bad criticism, but more a ‘Let the bird who laid the egg, nurture the egg’ sort of thing, which I believe long term will benefit all of us.

Posted: Sun May 28, 2006 9:59 pm
by Teknojnky
There is a start up volume control in tweakmonkey, I don't think it has anything from Steegy's scripts.. not intentionally anyway.

You can remove the volume 'pop' by setting the volume to zero, setting the play position, then restoring the previous volume.

Code: Select all

Sub OnStartUp 
Set Regs = SDB.Registry 
 If Regs.OpenKey("Resume Play", True) Then 
  If Regs.BoolValue("Unfinished") Then 
     If Regs.BoolValue("Played") Then 
        TempVolume = SDB.Player.Volume
        SDB.Player.Volume = 0
        SDB.Player.Play 
        SDB.Player.PlayBackTime=Regs.IntValue("StoppedAt") 
        SDB.Player.Volume = TempVolume
     Else 
        TempVolume = SDB.Player.Volume
        SDB.Player.Play 
        SDB.Player.PlayBackTime=Regs.IntValue("StoppedAt") 
        SDB.Player.Pause 
        SDB.Player.Volume = TempVolume
     End If 
  End if 
  Regs.CloseKey 
 End If 
Script.RegisterEvent SDB,"OnShutdown", "CheckPlaying" 
End Sub 

Posted: Wed Jun 07, 2006 7:13 am
by DiddeLeeDoo
I haven't tried this variation Teknojnky. If you say it is an alternative I take your word for it.

I have yet to find any problems with that this very simple fade-in. It does about 10 tiny volume changes over 1.2 seconds, which should be a piece of cake for even a 386 computer.

Nice to see there's an alternative to the start-up play function though. Thanks.

MM freezes when using Ozone

Posted: Tue Jun 20, 2006 2:27 pm
by uncl-nis
hey DiddeLeeDoo,

it was very nice to see that someone made a script like this for MM, something like this seems so required.
But i have a problem with it when using OZONE dsp ustility

http://www.quinnware.com/list_plugins.php?plugin=103

MM simply freezes unitl i kill it with Task Manager. if i turn OZONE off the script works just fine. have you any suggestions?

Thanks, Rudy

Posted: Tue Jun 20, 2006 5:50 pm
by rovingcowboy
:o Don't use OZone?

i use the old wide & dynamic dsp plug in . of course i use 16 bit sound cards but that plugin does not mess with anything.

i think the ozone plugin might be hogging ram. or resources.

8)