Weekly Top 40 Songs Report v1.10 [Script]

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: Weekly Top 40 Songs Report v1.10 [Script]

Re: Weekly Top 40 Songs Report v1.10 [Script]

by Eyal » Thu Jan 27, 2011 9:37 pm

Maybe this script: Play History & Stats Node by Bex: http://www.mediamonkey.com/forum/viewto ... =2&t=12368

Re: Weekly Top 40 Songs Report v1.10 [Script]

by superskid » Thu Jan 27, 2011 1:56 pm

This old script doesn't seem to work anymore? Unless I am doing something wrong.

Is there a new script that can accomplish this?

by salamat » Wed Oct 04, 2006 6:57 am

Salamat Kaayo!!!! Now it works!!!!

This is great! Thanks for all your helpfull advice and support.....Hope I can pay back a nice day..... :D

by paulmt » Wed Oct 04, 2006 1:45 am

I recall I had a similar problem.

Using search, locate wscript.exe (it should be in your system32 folder)
If not? download it, or perhaps it is on the WinXP CD

Right click on the *.vbs script you wish to open or edit and select "open with" browse to the wscript file and check "always open with... etc"
This makes wscript the default host for scripts.

Here is the Microsoft link to explain fully

http://tinyurl.com/gvpdq


Hope this helps

by rovingcowboy » Wed Oct 04, 2006 12:36 am

not sure about the missing script you have trouble with.

but wscript is also needing turned on more then likely one of the ms
updates turned it off?

there is ways to do it in the tools internt options of the explorer.

but i can not remember how.

you can also get the tweaking program from majorgeeks.com in the freeware section it is called xteq or go to xteq.com and get the free version from their site.

but there is a way to turn on the wscript in there.

if that wscript being off is your trouble that is what i would try and do.

if your having other issues with the computer i don't know.

8)

by DiddeLeeDoo » Wed Oct 04, 2006 12:14 am

Here's the manual run down of what the installer does, and after restarting MediaMonkey you should find Weekly Top 40 under
File - Create Report - Weekly Top 40

You may want to check if the installer file have done it already.

1. Make sure you have this section in your \MediaMonkey\Scripts\Scripts.ini

Code: Select all

[WeeklyTop40]
FileName=WeeklyTop40.vbs
ProcName=ShowStats
Order=5
DisplayName=&Weekly Top 40
Description=Library Statistics Report
Language=VBScript
ScriptType=1
2.
Copies this script to \MediaMonkey\Scripts\WeeklyTop40.vbs (not the \auto folder)

Code: Select all

'----------------------------------------------------------------------
'\Program Files\MediaMonkey\Scripts\WeeklyTop40.vbs
'
' Version: 1.1
' Date: 2 September 2006
' Based on the Stats.vbs Script: Script branch by DiddeLeeDoo
'----------------------------------------------------------------------
Private SOn
Sub ShowStats
    Wdt=640
Set Frm=SDB.UI.NewForm
    Frm.Common.SetRect 50,50,Wdt,400
    Frm.Common.MinWidth=200
    Frm.Common.MinHeight=150
    Frm.FormPosition=4
    Frm.Caption=SDB.Localize("Weekly Top 40")
    Frm.StayOnTop=True
    Frm.SavePositionName="Weekly Top 40"
Set Fot=SDB.UI.NewPanel(Frm)
    Fot.Common.Align=2
    Fot.Common.Height=35
Set Ddo=SDB.UI.NewDropDown(Fot)
    Ddo.Style=2
    Ddo.Common.SetRect Wdt-500,6,150,24
    Ddo.Common.Anchors=4+8
    Ddo.Common.ControlName="Ddo"
    x=DateDiff("w",SDB.Database.OpenSQL("Select First(PlayDate) from Played").StringByIndex(0),Date)
For i = 0 To x-1
    Ddo.AddItem FormatDateTime((Date-DatePart("w",date)+1)-(7*i),1)
Next
    Ddo.ItemIndex=0
    Ddo.UseScript = Script.ScriptPath
    Ddo.OnSelectFunc="DoWeek"
Set Btn=SDB.UI.NewButton(Fot)
    Btn.Caption=SDB.Localize("&Save as...")
    Btn.Common.SetRect Wdt-255,6,150,24
    Btn.Common.Anchors=4+8
    Btn.UseScript=Script.ScriptPath
    Btn.OnClickFunc="SaveAs"
Set Btn=SDB.UI.NewButton(Fot)
    Btn.Caption=SDB.Localize("&Close")
    Btn.Common.SetRect Wdt-100,6,85,24
    Btn.Common.Anchors=4+8
    Btn.UseScript=Script.ScriptPath
    Btn.OnClickFunc="OnClose"
Set Sxp=SDB.UI.NewActiveX(Frm,"Shell.Explorer")
    Sxp.Common.Align=5
    Sxp.Common.ControlName="Web"
Set Rpt=Sxp.Interf.Document
    Rpt.Write Content(False,0)
    Rpt.Close    
    SDB.Objects("WeeklyTop40")=Frm
    Frm.Common.Visible=True
End Sub

Function DoWeek(Ddo)
Set Doc=SDB.Objects("WeeklyTop40").Common.ChildControl("Web").Interf.Document
    Doc.Write Content(False,Ddo.ItemIndex)
    Doc.Close
End Function


Sub OnClose(Btn)
    SDB.Objects("WeeklyTop40").Common.Visible=False
    SDB.Objects("WeeklyTop40")=Nothing 
End Sub

Sub SaveAS(Btn)
    x=SDB.Objects("WeeklyTop40").Common.ChildControl("Ddo").ItemIndex
    With SDB.CommonDialog
        .DefaultExt="html"
        .Filter="HTML (*.htm)|*.htm|All files (*.*)|*.*"
        .Title=SDB.Localize("Exporting...")
        .InitDir=SDB.IniFile.StringValue("Scripts", "LastExportStatsDir")
        .ShowSave
    bSv=.Ok
    xTo=.FileName
    End With
    If bSv Then With SDB.Tools.FileSystem.CreateTextFile(xTo,True):.Write Content(True,x):.Close:End With
End Sub 

Function Content(bEx,w)
Set Doc=New Page
    Doc.Add "<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"">"
    Doc.Add "<html>"
    Doc.Add "  <head>"
    Doc.Add "    <title>"
    Doc.Add "      "&SDB.Localize("Weekly Top 40")
    Doc.Add "    </title>"
    Doc.Add "      <base href=""file:///" &Home& """>"
    Doc.Add "  </head>"
    Doc.Add "  <STYLE TYPE=text/css>"
    Doc.Add "    body{font-family:'Verdana',sans-serif; background-color:#FFFFFF; font-size:9pt; color:#000000;}"
    Doc.Add "    H1{font-family:'Verdana',sans-serif; font-size:13pt; font-weight:bold; color:#AAAAAA; text-align:Center}"
    Doc.Add "    P{font-family:'Verdana',sans-serif; font-size:9pt; color:#000000;}"
    Doc.Add "    TH{font-family:'Verdana',sans-serif; font-size:10pt; font-weight:bold; color:#000000; border-color:#000000; border-style: solid; border-left-width:0px; border-right-width:0px; border-top-width:0px; border-bottom-width:3px;}"
    Doc.Add "    TD{font-family:'Verdana',sans-serif; font-size:9pt; color:#000000; border-color:#000000; border-style: solid; border-left-width:0px; border-right-width:0px; border-top-width:0px; border-bottom-width:1px;}"
    Doc.Add "    TR.dark{background-color:#EEEEEE}"
    Doc.Add "    TR.aleft TH{text-align:left}"
    Doc.Add "   </STYLE>"
    Doc.Add "  <body>"
    Doc.Add "    <H1>"
    Doc.Add "      "&SDB.Localize("Weekly Top 40")
    Doc.Add "    </H1>"
    Doc.Add "    <table border=""0"" cellspacing=""0"" cellpadding=""4"" width=""100%"">"
    Doc.Add "      <tr>"
    Doc.Add "        <th colspan=""5"">"
    Doc.Add "          "&FormatDateTime((Date-DatePart("w",date)+1)-(7*w),1)
    Doc.Add "        </th>"
    Doc.Add "      </tr>"
    Doc.Add "      <tr class=""aleft"">"
    Doc.Add "        <th>" & "#" & "</th>"   
    Doc.Add "        <th>" & SDB.Localize("Rating") & "</th>"   
    Doc.Add "        <th>" & SDB.Localize("Song")   & "</th>"   
    Doc.Add "        <th>" & SDB.Localize("Artist") & "</th>"
    Doc.Add "        <th>" & SDB.Localize("Album")  & "</th>"
    Doc.Add "      </tr>"   :Set dbT=SDB.Database.OpenSQL(SQL(w)) :For i=1 To 40 :If dbT.EOF Then Exit For 
    Doc.Add "      <tr" & Style() & ">"  
    Doc.Add "        <td>" & i &"</td>"
    Doc.Add "        <td>" & ShowRating(dbT.StringByName("Rating"),bEx) & "</td>"
    Doc.Add "        <td>" & MapXML(dbT.StringByName("SongTitle"))&" <font size=-2>("&dbT.StringByName("CountOfIdPlay")&")</font></td>"
    Doc.Add "        <td>" & MapXML(dbT.StringByName("Artist"))&"</td>"
    Doc.Add "        <td>" & MapXML(dbT.StringByName("Album")) &"</td>"
    Doc.Add "      </tr>":   dbT.Next                             :Next
    Doc.Add "    </table>"
    Doc.Add "    <table border=""0"" cellspacing=""0"" cellpadding=""4"" width=""100%"">"
    Doc.Add "      <tr>"
    Doc.Add "        <td style='border-bottom-width:0px'>"
    Doc.Add "          "&SDB.Localize("Generated by ") & "<a href='http://www.mediamonkey.com'>MediaMonkey</a>" & SDB.Localize(" on ") & MapXML(FormatDateTime(date(), vbLongDate)) & " " & SDB.Localize("at") & " " & MapXml(FormatDateTime(time(), vbLongTime))
    Doc.Add "        </td>"
    Doc.Add "      </tr>"
    Doc.Add "    </table>"
    Doc.Add "  </body>"
    Doc.Add "</html>"
    Content=Doc.Content
End Function 

Function Home
    Tmp=SDB.ApplicationPath&"Scripts\"
    Tmp=Replace(Tmp, " ", "%20")
    Tmp=Replace(Tmp, "\", "/")
    Home=Tmp
End Function

Function MapXML(strX)
    stX=Replace(strX, "&", "&")
    stX=Replace(strX, "<", "<")
    stX=Replace(strX, ">", ">")
          i=1
    While i<=Len(stX)
          If (AscW(Mid(stX,i,1))>127) Then stX=Mid(stX,1,i-1)+"&#"+CStr(AscW(Mid(stX,i,1)))+";"+Mid(stX,i+1,Len(stX))
          i=i+1
    Wend
    If strX="" Then strX="&nbsp;"
MapXML=strX
End Function

Function ShowRating(RDe, bEx)
    If     RDe=-1 Then
           ShowRating=" "
    ElseIf RDe=0 Then
        If  Not bEx Then
            ShowRating="<img border=""0"" src=""bomb.png"" width=""10"" height=""11"">"
        Else
            ShowRating="0"
        End If 
    Else
      For a=20 To RDe Step 20
        If  Not bEx Then 
            ShowRating=ShowRating & "<img border=""0"" src=""star.png"" width=""10"" height=""11"">"
        Else 
            ShowRating=ShowRating & "*"
        End If
      Next
    End If
    
    If (RDe Mod 20) >=10 Then
      If  Not bEx Then 
          ShowRating=ShowRating & "<img border=""0"" src=""half-star.png"" width=""10"" height=""11"">"
      Else 
          ShowRating=ShowRating & "'"
      End If
    End If
End Function

Class Page
Dim ATable,AddRows,Row
    Private Sub Class_Initialize()
        AddRows=50:Row=0:ReDim ATable(AddRows)
    End Sub
    Public Sub Add(Line)
        If Row > UBound(ATable) Then ReDim Preserve ATable(UBound(ATable)+AddRows)
        ATable(Row)=Line:Row=Row+1
    End Sub
    Public Function Content
        Content=Join(ATable,vbNewLine)
    End Function
End Class

Function SQL(w)
SQL="SELECT Count(Played.IdPlay) AS CountOfIdPlay, Songs.Rating, Songs.SongTitle, Artists.Artist, Albums.Album "&_
    "FROM ((Songs INNER JOIN Artists ON Songs.IDArtist=Artists.ID) INNER JOIN Albums ON Songs.IDAlbum=Albums.ID) INNER JOIN Played ON Songs.ID=Played.IdSong "&_
    "GROUP BY Year(PlayDate), DatePart('ww',PlayDate), Songs.Rating, Songs.SongTitle, Artists.Artist, Albums.Album "&_
    "HAVING (((DatePart('ww',PlayDate))=DatePart('ww',Now())-"&w&"-1)) "&_
    "ORDER BY Year(Played.PlayDate) DESC , DatePart('ww',Played.PlayDate) DESC , Count(Played.IdPlay) DESC , Songs.Rating DESC "
End Function

Function Style
    SOn=Not SOn:If SOn Then Style="" Else Style=" class=""Dark"""  End If
End Function

by salamat » Tue Oct 03, 2006 11:29 pm

OK, I tried your advice, runned the CScript //H:WScript, moved the zip file to another folder and doubleclicked, and MM started up normaly, but could not find the script anywhere in MM

When I search c:\ for the installed script, nothing is found ether. So it seems like there is something wrong here. Any ideea?

by DiddeLeeDoo » Tue Oct 03, 2006 9:55 am

Hi Salamat,
Thanks for putting a big smile on my face. G'day from down here.! The global nature of this forum is good fun.

Sounds like one of the programs on your machine have put the scripting engine out of tune.

You could try this to see if that helps

Do the Windows Start button and find- 'Run' and write

CScript //H:WScript

and hit OK

This should reset your scripting system to defaults.

These self-install scripts I do rely on that your scripting system is normal.

All that you need to do with these, is simply double clicking it from anywhere. It is enough just to open the zip file and double click the file from within the zip file. No need to extract it to anywhere.

If you happen to have the install file in the MediaMonkey folders, you are most likely best off by taking the install file away from there.

Nothing have changed with the script over the last couple of weeks. In fact, work prevent me from focusing on scripting at the moment, but I hope to get some time at the end of the week.

by salamat » Tue Oct 03, 2006 9:10 am

DiddeLeeDoo!

This script is great, but......there is something strange.....I installed it before, and it worked. I was able to write a top 40 report, and so fare so good. But then I had to uninstal and reinstal MM again, due to a crash, and when I tried to download this script again, and reinstal it, I have this error #424; Object required: "Wscript"......I tried everything possible, but to no avail..... did you change something in the script last weeks? I mean, since it worked before for me????

Yes, I have this wscript in the system folder, but can this file have been corrupted?l

BTW, it's always very helpful for us newbies to have a helpfile with all the instalation tips and guides, or even better, a instalation program to setup everything and make shure everthing is done right.....

This is the way I did it; Downloaded the zipfile to the script\autofolder, unzipped, and it ended up in a subfolder called MediaMonkey_weekly top 40...v.110 folder, tried to doubleclik it from there, it didn't work, so i moved it to the auto folder, and doubleclikked it again, but still no new top 40 report in the file\create report menu.....maybe I did somthing wrong? That's why we need a detailed guide to make shure we do every detail the way it's suppose to be done......Don't remember how I did it in the first place to make it work......;-)

Salamat kaayo! (Means; Thank you very much (or a lot) in the Philippines)
And keep up your good work!!!! It's amazing how much improvement you and your fellow scripters are doing for MM!!!!!

by DiddeLeeDoo » Wed Sep 20, 2006 9:47 am

Thanks Kit,

I suppose to do more with this one, but available spare time have been a bit limited over the last couple of weeks. Will get on to it when time allow.

by Kit » Wed Sep 20, 2006 9:36 am

This script is awesome ... it would be really great if you could also get it to create the playlist of the top 40 :P

by DiddeLeeDoo » Wed Sep 06, 2006 7:04 am

Hopefully just a temporary fault somewhere on the net. Seems to be alright now.

by Sgrom » Wed Sep 06, 2006 4:15 am

Link is down :(

by Bex » Sat Sep 02, 2006 7:44 am

Cool script!

by DiddeLeeDoo » Sat Sep 02, 2006 4:12 am

Bump to say the week selector is now a part of the script. Goes all the way back to the first day in the current play history.

Top