Test script for rotating album art [#10406]

Post a reply

Smilies
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Test script for rotating album art [#10406]

Re: Test script for rotating album art [#10406]

by rovingcowboy » Mon Nov 24, 2014 2:14 am

Gamb2009 get a tweaking program for your opsystem make sure it has feature to clean out bad code pages , reset registry keys that were messed up by bad scripts or malware. I use both the xteq pro tweaking program and the tweaking.com one on my xp systems. They generally fix anything in the registry the others i use can't. 8)

Re: Test script for rotating album art [#10406]

by gamb2009 » Thu Nov 20, 2014 1:47 pm

Lowlander wrote:The script could be called from Program Files\MediaMonkey\Scripts\Scripts.ini or have remnants in the Program Files\MediaMonkey\Scripts\Auto folder.
Thank you for your answer. But those places and files were the first I looked for, and the call is not there. Most strange is that I performed a full unistall of MM, erased all known folders in my hard dirive associated with MediaMonkey (Users\AppData\Mediamonkey\...; \Program Files (x86)\Medimonkey\...; etc.), ... and the scripts continues to throw the error message. Very strange and frustrating.

I have tried logging in as a different user in my computer. In that case, the script is not run, so it has to do with my user name. But where is it set?

Re: Test script for rotating album art [#10406]

by Lowlander » Wed Nov 19, 2014 7:39 pm

The script could be called from Program Files\MediaMonkey\Scripts\Scripts.ini or have remnants in the Program Files\MediaMonkey\Scripts\Auto folder.

Re: Test script for rotating album art [#10406]

by gamb2009 » Wed Nov 19, 2014 6:30 pm

I have tried unsuccessfuly to install this script, however, some part of it did perform some kind of installation, so now, every time a track is played, I get an error message that says that the script could not be opened. Now I want to remove that and I am trying to find where is the instruction that is trying to run the script but I can't find it. After Uninstalling and reinstalling MM, The error continues to appear. I would appreciate any help or ideas about what to do. Could it be some place in the Registry of Windows, or somewhere else?

Re: Test script for rotating album art [#10406]

by nohitter151 » Sat Jun 15, 2013 7:57 am

It appears as though the script author wrote the script so that you double click the file to install it.

It didn't work in your first case because you must run the file as the admin.

Also, the script is 7 years old, written for a much older version of MM, so I would bet that it won't work anyway.

Re: Test script for rotating album art [#10406]

by samatriXdigitaL » Fri Jun 14, 2013 11:25 pm

An update on my script install issue.
I altered my scripts.ini file to add "CycleArt.vbs".
Now I get a listing for CycleArt in my MM scripts menu. When I select it I get the following error.

Error #424-Microsoft VBScript runtime error
Object required: 'WScript'
File: "C:\Program Files (x86)\MediaMonkey\Scripts\CycleArt.vbs", LIne:25, column:3

Any ideas?

Re: Test script for rotating album art [#10406]

by samatriXdigitaL » Fri Jun 14, 2013 11:11 pm

I'm not able to install this script.
I've named it "CycleArt.vbs" and placed it in my MM "scripts" directory.
When I double click it I get the following error message.

Line: 3
Char: 11
Error: The requested operation requires elevation.
Code: 800702E4
Source: (null)

Running MM v 4.0.7.1511

Any help would be appreciated. It's a great idea.

Re: Test script for rotating album art

by Peke » Mon Jan 14, 2013 6:09 pm

Re: Test script for rotating album art

by SchulA » Mon Jan 14, 2013 7:27 am

sounds cool - that´s what I ´ve been waiting for.

It even would be cool to have a button for manually switching through the different album arts of a given song (not having to use the popup)...

Re: Test script for rotating album art

by rovingcowboy » Sat Dec 22, 2012 2:30 pm

How the world did i miss this thread i been wanting this now ever since mm3 when i got in to album art.

by Steegy » Fri Nov 17, 2006 6:52 pm

I don't know any way to do what you want (except from using an external application that simulates a right-click on the album art window, and then figures out a way to simulate a left-click on the pop-up menu, to show the next image... but hey :-? :roll:).
Considering that what your script does is a know wish, I thought it might come in a future MM version natively. If this will take long (you should ask the MM devs about that), you can ask them a way to change the displayed album art in MediaMonkey, through scripting: Post your new scripting functionality wishes here.

Cheers
Steegy

Problem with script?

by Wim » Fri Nov 17, 2006 2:41 am

Hello Guest,

Wat does not work? You need at least 2 pictures as albumart with a track (else there's nothing to cycle :) ) and you have to set the albumart image screen to "now playing". And of course you have to activate the script from the tools->option sheet ...

Doe any of the guru's out there have an answer to my question?
I could not get access to the popup menu of the "Album Art (Now Playing)" so I change the album art of the song and do an update. This gives a small hick up during the play.

So my question, does anybody have an idea if (and how) I can influence the popup menu (so I can select the "next" picture)?
Wim[/quote]

by Guest » Thu Nov 16, 2006 3:00 pm

don't work here, but i like the idea :D
in future maybe i can use this to hear the music and see photos of the band/artist in mm.
sorry for my english and good luck :wink:

New code for CycleArt (used to be RotateArt)

by Wim » Thu Nov 16, 2006 1:28 pm

Hi people,

I changed the script to avoid the timer problem. Seams to work :)
The original problem is still there (the hick up, no new info on that).

This script cycles through all pictures (album art) of the current song (if it has any) it always works in sequence (hence not renamed to AlbumArtShuffle).

Enjoy ...

Code: Select all

'-----------------------------OPEN-------------------------------------
Dim FSO : Set FSO=CreateObject("Scripting.FileSystemObject")
Dim SDB : Set SDB=CreateObject("SongsDB.SDBApplication")
While Not SDB.isRunning : WScript.Sleep 500 : Wend
'----------------------------------------------------------------------
Prepare
InstallScriptTo "Auto\CycleArtSetting.vbs" ,066, 141,"none"
InstallScriptTo "CycleArt.vbs"             ,143, 246,_
"Script Successfully Installed!"            &vbLf&_
"Go to "                                    &vbLf&_
"Tools - Cycle Art"                        &vbLf&_
"to change the settings."
'------------------------------CLOSE-----------------------------------
SDB.ShutdownAfterDisconnect=True
Set FSO=Nothing : Set SDB=Nothing : Wscript.Quit

'%%%%%%%%%%%%%%%%% START OF SCRIPT INSTALLER %%%%%%%%%%%%%%%%%%

Sub InstallScriptTo(ScriptName, LineBegin, LineEnd, Message)

	ScriptName=SDB.ApplicationPath & "Scripts\" & ScriptName

	RenameOldScript(ScriptName)

	Set TXT=FSO.OpenTextFile(WScript.ScriptFullName,1)
	STR=TXT.ReadAll
	TXT.Close

	LNS=Split(STR,vbNewLine)

	Set TXT=FSO.CreateTextFile(ScriptName, True)
	For i=LineBegin-1 To LineEnd-1
	TXT.WriteLine LNS(i)
Next
TXT.Close

If FSO.FileExists(ScriptName) And Message<>"none" Then _
	SDB.MessageBox Message , 2, Array(4)
End Sub

Sub RenameOldScript(ScriptName)
	If FSO.FileExists(ScriptName) Then _
		FSO.MoveFile ScriptName, BakFile(ScriptName)
	End Sub

	Function BakFile(ScriptName)
	Do
		TMP=Left(ScriptName, Len(ScriptName)-3) & "old" & v
		v=v+1
	Loop While FSO.FileExists(TMP)
	BakFile=TMP
End Function

Sub Prepare
	RenameOldScript(SDB.ApplicationPath&"Scripts\CycleArt.vbs")

	Set INI=SDB.Tools.IniFileByPath(SDB.ApplicationPath&"Scripts\Scripts.ini")
	INI.StringValue("CycleArt","FileName")="CycleArt.vbs"
	INI.StringValue("CycleArt","ProcName")="CycleArt"
	INI.StringValue("CycleArt","Language")="VBScript"
	INI.IntValue("CycleArt","ScriptType")=2


End Sub
'%%%%%%%%%%%%%%%%%% END OF SCRIPT INSTALLER %%%%%%%%%%%%%%%%%%%
'-------------------------------------------------------------------------------
' file to create a settings form for CycleArt
' Version 1.1
' date 16 nov 2006.
' Version 1.1 changed name from Rotate to Cycle
'-------------------------------------------------------------------------------

Sub OnStartup
	MyScript = SDB.ApplicationPath & "scripts\CycleArt.vbs"
	' setup menu values on tools
	Set UI = SDB.UI
	' Add a submenu to the Tools menu...
	Set Mnu = UI.AddMenuItem( UI.Menu_Tools, -1, 1)
	Mnu.Caption = "Cycle Art"
	Mnu.Caption = "Cycle"
	Mnu.OnClickFunc = "CycleNow"
	Mnu.UseScript=MyScript
	Mnu.IconIndex = 25

  ' and on the now playing popup.
	Set Mnu = UI.AddMenuItem( UI.Menu_Pop_NP, -1, 1)
	Mnu.Caption = "Cycle"
	Mnu.OnClickFunc = "CycleNow"
	Mnu.UseScript=MyScript
	Mnu.IconIndex = 25
  ' Create our own option sheet
  ind = SDB.UI.AddOptionSheet( "Cycle Art", Script.ScriptPath, "InitSheet", "SaveSheet", 0)
End Sub

Sub InitSheet( Sheet)
  ' Create a simple sheet with an edit line and a button
  Set UI=SDB.UI
  ' checkbox want it ?
  Set CbActive = UI.NewCheckBox(Sheet)
  CbActive.Caption="Activate Cycle Art"
  Cbactive.Common.ControlName = "cbActive"
  Cbactive.Common.SetRect 50, 20, 200, 20
  ' Create a label on the form
  Set Lbl = UI.NewLabel( Sheet)
  Lbl.Common.SetRect 50, 40, 200, 20
  Lbl.Caption = "Please set a value for the Cycle time (in seconds)"

  ' Create an edit line
  Set Edt = UI.NewEdit( Sheet)
  Edt.Common.SetRect 50, 60, 30, 20
  Edt.Text = "40"
  Edt.Common.ControlName = "tbTime"

  ' Retrieve already entered value from registry
  Set Regs = SDB.Registry
  If Regs.OpenKey( "Cycle Art", True) Then
    If Regs.ValueExists( "RTime") Then
      Edt.Text = Regs.StringValue( "RTime") / 1000
    End If
    If Regs.ValueExists( "Active") Then
      CbActive.checked = Regs.StringValue( "Active")
    End If
    Regs.CloseKey
  End If
End Sub

Sub SaveSheet( Sheet)
   ' Save entered value to registry in order to be able to shown it next time
  Set Regs = SDB.Registry
  Set Edt = Sheet.Common.ChildControl( "tbTime")
  Set CbActive = Sheet.Common.ChildControl( "cbActive")
  If IsNumeric(edt.text) Then
  	If Regs.OpenKey( "Cycle Art", True) Then
    	Regs.StringValue("RTime") = Edt.Text * 1000
    	Regs.StringValue( "Active") = CbActive.checked
    	Regs.CloseKey
  	End If
  Else
  	SDB.MessageBox "Value '" & edt.text & "' is not a valid number'" , mtInformation, Array(mbOk)
  End If
End Sub

'-------------------------------------------------------------------------------
' Script to Cycle the album art in mediamonkey
' Version 1.1
' date 16 nov 2006.
' Version 1.1 new setup, to get the timer right
'   changed name from Rotate to Cycle
'-------------------------------------------------------------------------------

Sub OnStartup
	CycleArt
End Sub

' Called from the menubars
Function CycleNow(Item)
	If CanCycle Then
		CycleArt
	End If
End Function

Sub CycleArt
	If CanCycle Then
		StartTimer
	End If
End Sub

Function CanCycle
	CanCycle=true
	' are all settings correct?
	Set REG=SDB.Registry
	If REG.OpenKey( "Cycle Art", True) Then
		If REG.ValueExists( "Active") Then
  		CanCycle = REG.StringValue( "Active")
		End If
	End If
	' pictures available
	Set Sng=SDB.Player.CurrentSong
	Set art=sng.AlbumArt
	If art.count < 2 Then
  	CanCycle=false
	End If
	' don't cycle when stopped
	If Not SDB.Player.isPlaying Then
  	CanCycle=false
	End If
End Function

Sub StartTimer
	Set REG=SDB.Registry
	If REG.OpenKey("Cycle Art", True) Then
		If REG.ValueExists( "RTime") Then
			Rtime = REG.StringValue( "RTime")
		Else
			Rtime = 40000 ' Default is 40 seconds
		End If
	End If
	Set Tmr = SDB.CreateTimer( Rtime )   ' Cycle in "Rtime" seconds
	Script.RegisterEvent Tmr, "OnTimer", "TestTimer"
End Sub

Sub TestTimer( Timer)
	' timer fired, do we still need it?
  If canCycle Then
  	' yes, cycle picture
  	Cycle
  Else
  	' no, stop the timer
  	Script.UnregisterEvents Timer  ' Terminate usage of this timer
 	End If
End Sub

Sub Cycle
	Dim MyPic
	Dim ThisSong
	Dim TmpPic
	Set REG=SDB.Registry
	If REG.OpenKey("Cycle Art", True) Then
		ThisSong = REG.IntValue("CurrSong")
		MyPic = REG.IntValue("LastPic")
	End If
	Set Sng=SDB.Player.CurrentSong
	Set art=sng.AlbumArt
	' set MyPic to 0 (first pic) when last pic, or new song
	If  ThisSong <> Sng.ID Then
		MyPic = 0
	Else
		MyPic = MyPic + 1
	End If
	If MyPic >= art.count Then
		MyPic = 0
	End If
	' if MyPic = 0, restarted, nothing to switch
	If MyPic <> 0 Then
		' the Cycle, change picture 0 with MyPic
		Set tmppic = art.item(0)
		Set art.item(0) = art.item(MyPic)
		Set art.item(MyPic)  = tmppic
		art.UpdateDB
	End If

	' save the current state
	REG.IntValue("CurrSong") = Sng.ID
	REG.IntValue("LastPic") = MyPic
	REG.CloseKey
End Sub

by powerpill-pacman » Thu Nov 16, 2006 3:24 am

I've really been waiting for this. Thanks very much.

Top