3.0.1.1127 --- player does not want to stop via scripting

Beta Testing for Windows Products and plugins

Moderator: Gurus

Teknojnky
Posts: 5537
Joined: Tue Sep 06, 2005 11:01 pm
Contact:

3.0.1.1127 --- player does not want to stop via scripting

Post by Teknojnky »

This script which worked fine in mm2 does not stop the player properly.

Pause does seem to work.

I added a msgbox before and after 2 stop statements and neither stop is working.

Code: Select all

'========================================================================== 
' 
' MediaMonkey Script 
' 
' NAME: Stop After Current 
' DESCRIPTION: adds 2 icons to the standard toolbar, to stop and pause 
'   after the current song finishes' 
' VERSION: 1.0 
' DATE  : July 16, 2007 
' AUTHOR: Teknojnky 
' 
' INSTALL: 
' - Copy script to MM directory scripts\auto 
' 
' TODO: 
' 
' 
'========================================================================== 
' 
Option Explicit 

'Public StopAfterTBB 
'Public PauseAfterTBB 
  
  
Sub OnStartUp() 

    Do While Not SDB.IsRunning
      SDB.ProcessMessages
    Loop


' add toolbar icons for pause after, and stop after, on the player toolbar 

' add separater' 
  SDB.UI.AddMenuItemSep SDB.UI.Menu_TbStandard,0,0 
  
' toggle pause button' 

  Dim PauseAfterTBB : Set PauseAfterTBB = SDB.UI.AddMenuItem(SDB.UI.Menu_TBStandard,0,0) 
  PauseAfterTBB.Caption = SDB.Localize("Pauses play after currently playing song") 
  PauseAfterTBB.OnClickFunc = "PauseAfter" 
  PauseAfterTBB.UseScript = Script.ScriptPath 
  PauseAfterTBB.IconIndex = 2 
  SDB.Objects("PauseAfterTBB") = PauseAfterTBB 

' toggle stop button' 
  
  Dim StopAfterTBB : Set StopAfterTBB = SDB.UI.AddMenuItem(SDB.UI.Menu_TBStandard,0,0) 
  StopAfterTBB.Caption = SDB.Localize("Stops play after currently playing song") 
  StopAfterTBB.OnClickFunc = "StopAfter" 
  StopAfterTBB.UseScript = Script.ScriptPath 
  StopAfterTBB.IconIndex = 3 
  SDB.Objects("StopAfterTBB") = StopAfterTBB 

End Sub 


Sub PauseAfter(PauseAfterTBB) 

  Script.UnRegisterAllEvents 

  If PauseAfterTBB.Checked = False Then 
    PauseAfterTBB.Checked = True 
    SDB.Objects("StopAfterTBB").Checked = False     
    Call Script.RegisterEvent(SDB, "OnPlay", "DoAfter") 
  ElseIf PauseAfterTBB.Checked = True Then 
    PauseAfterTBB.Checked = False 

  End If 
  
End Sub 


Sub StopAfter(StopAfterTBB) 

  Script.UnRegisterAllEvents 
  
  If StopAfterTBB.Checked = False Then 
    StopAfterTBB.Checked = True 
    SDB.Objects("PauseAfterTBB").Checked = False     
    Call Script.RegisterEvent(SDB, "OnPlay", "DoAfter") 
  ElseIf StopAfterTBB.Checked = True Then 
    StopAfterTBB.Checked = False 
  End If 
'     SDB.Player.Stop
End Sub 


Sub DoAfter()  
  Script.UnRegisterAllEvents 
  If SDB.Objects("PauseAfterTBB").Checked = True Then  
    SDB.Player.Pause 

  ElseIf SDB.Objects("StopAfterTBB").Checked = True Then 
    SDB.Player.Stop 
msgbox("Player should have stopped before or at least after this")
    SDB.Player.Stop
  End If 
  
  SDB.Objects("PauseAfterTBB").Checked = False 
  SDB.Objects("StopAfterTBB").Checked = False     
End Sub 
PetrCBR
Posts: 1778
Joined: Tue Mar 07, 2006 5:31 pm
Location: Czech
Contact:

Re: 3.0.1.1127 --- player does not want to stop via scriptin

Post by PetrCBR »

Thanks. Will be fixed in next release.
Teknojnky
Posts: 5537
Joined: Tue Sep 06, 2005 11:01 pm
Contact:

Post by Teknojnky »

seems to be fixed, thanks!
Post Reply