by trixmoto » Wed Sep 20, 2006 2:55 pm
As requested
here, this script lists all of the artists from your list of visible (or selected) tracks, in a simple text file.
If you want to print an alphabetical list of all your artists then click on the Artists node, and then the Artist column to sort, before running the report.
The installer is available from my website.
Code: Select all
'
' MediaMonkey Script
'
' NAME: JustListArtists 1.1
'
' AUTHOR: trixmoto (http://trixmoto.net)
' DATE : 20/03/2008
'
' INSTALL: Copy to Scripts directory and add the following to Scripts.ini
' Don't forget to remove comments (') and set the order appropriately
'
' [JustListArtists]
' FileName=JustListArtists.vbs
' ProcName=JustListArtists
' Order=2
' DisplayName=Just List Artists
' Description=Just List Artists
' Language=VBScript
' ScriptType=1
'
' Fixes: Made compatible with MM3
'
Option Explicit
Sub JustListArtists
Dim list : Set list = SDB.CurrentSongList
If list.Count = 0 Then
Call SDB.MessageBox(SDB.Localize("Select tracks to be exported, please."), mtError, Array(mbOk))
Exit Sub
End If
If SDB.VersionHi < 3 Then
Set list = list.Artists
End If
Dim fso : Set fso = SDB.Tools.FileSystem
Dim path : path = Script.ScriptPath&".txt"
Dim fout : Set fout = fso.CreateTextFile(path,True)
Dim dic : Set dic = CreateObject("Scripting.Dictionary")
Dim Progress : Set Progress = SDB.Progress
If SDB.VersionHi < 3 Then
Progress.MaxValue = list.Count
Else
Progress.MaxValue = list.Count*2
End If
Progress.Text = SDB.Localize("Exporting...")
Dim i,j,itm,arr
For i = 0 To list.Count-1
Set itm = list.Item(i)
If SDB.VersionHi < 3 Then
If itm.ID > 0 Then
Call fout.WriteLine(itm.Name)
End If
Else
arr = Split(itm.ArtistName,";")
For j = 0 To UBound(arr)
dic.Item(Trim(arr(j))) = ""
Next
End If
Progress.Increase
SDB.ProcessMessages
If Progress.Terminate Then
Exit For
End If
Next
If SDB.VersionHi > 2 Then
arr = dic.Keys
Call SortArray(arr)
Progress.MaxValue = list.Count+dic.Count
For i = 0 To UBound(arr)
Call fout.WriteLine(arr(i))
Progress.Increase
SDB.ProcessMessages
If Progress.Terminate Then
Exit For
End If
Next
End If
fout.Close
If Not Progress.Terminate Then
Dim WShell : Set WShell = CreateObject("WScript.Shell")
i = WShell.Run(Chr(34)&path&Chr(34),1,0)
End If
End Sub
Sub SortArray(arr)
Call QuickSort(arr,LBound(arr),UBound(arr))
End Sub
Sub QuickSort(vec,loBound,hiBound)
Dim pivot,loSwap,hiSwap,temp
If hiBound - loBound = 1 Then
If Vec(loBound) > Vec(hiBound) Then
temp = Vec(loBound)
Vec(loBound) = Vec(hiBound)
Vec(hiBound) = temp
End If
End If
pivot = Vec(Int((loBound + hiBound) / 2))
Vec(Int((loBound + hiBound) / 2)) = Vec(loBound)
Vec(loBound) = pivot
loSwap = loBound + 1
hiSwap = hiBound
Do
While loSwap < hiSwap And Vec(loSwap) <= pivot
loSwap = loSwap + 1
WEnd
While Vec(hiSwap) > pivot
hiSwap = hiSwap - 1
WEnd
If loSwap < hiSwap then
temp = Vec(loSwap)
Vec(loSwap) = Vec(hiSwap)
Vec(hiSwap) = temp
End If
Loop While loSwap < hiSwap
Vec(loBound) = Vec(hiSwap)
Vec(hiSwap) = pivot
If loBound < (hiSwap - 1) Then
Call QuickSort(vec,loBound,hiSwap-1)
End If
If hiSwap + 1 < hibound Then
Call QuickSort(vec,hiSwap+1,hiBound)
End If
End Sub
Sub Install()
Dim inip : inip = SDB.ApplicationPath&"Scripts\Scripts.ini"
Dim inif : Set inif = SDB.Tools.IniFileByPath(inip)
If Not (inif Is Nothing) Then
inif.StringValue("JustListArtists","Filename") = "JustListArtists.vbs"
inif.StringValue("JustListArtists","Procname") = "JustListArtists"
inif.StringValue("JustListArtists","Order") = "2"
inif.StringValue("JustListArtists","DisplayName") = "Just List Artists"
inif.StringValue("JustListArtists","Description") = "Just List Artists"
inif.StringValue("JustListArtists","Language") = "VBScript"
inif.StringValue("JustListArtists","ScriptType") = "1"
SDB.RefreshScriptItems
End If
End Sub
As requested [url=http://www.mediamonkey.com/forum/viewtopic.php?t=12219]here[/url], this script lists all of the artists from your list of visible (or selected) tracks, in a simple text file.
If you want to print an alphabetical list of all your artists then click on the Artists node, and then the Artist column to sort, before running the report.
The installer is available from my website.
[code]'
' MediaMonkey Script
'
' NAME: JustListArtists 1.1
'
' AUTHOR: trixmoto (http://trixmoto.net)
' DATE : 20/03/2008
'
' INSTALL: Copy to Scripts directory and add the following to Scripts.ini
' Don't forget to remove comments (') and set the order appropriately
'
' [JustListArtists]
' FileName=JustListArtists.vbs
' ProcName=JustListArtists
' Order=2
' DisplayName=Just List Artists
' Description=Just List Artists
' Language=VBScript
' ScriptType=1
'
' Fixes: Made compatible with MM3
'
Option Explicit
Sub JustListArtists
Dim list : Set list = SDB.CurrentSongList
If list.Count = 0 Then
Call SDB.MessageBox(SDB.Localize("Select tracks to be exported, please."), mtError, Array(mbOk))
Exit Sub
End If
If SDB.VersionHi < 3 Then
Set list = list.Artists
End If
Dim fso : Set fso = SDB.Tools.FileSystem
Dim path : path = Script.ScriptPath&".txt"
Dim fout : Set fout = fso.CreateTextFile(path,True)
Dim dic : Set dic = CreateObject("Scripting.Dictionary")
Dim Progress : Set Progress = SDB.Progress
If SDB.VersionHi < 3 Then
Progress.MaxValue = list.Count
Else
Progress.MaxValue = list.Count*2
End If
Progress.Text = SDB.Localize("Exporting...")
Dim i,j,itm,arr
For i = 0 To list.Count-1
Set itm = list.Item(i)
If SDB.VersionHi < 3 Then
If itm.ID > 0 Then
Call fout.WriteLine(itm.Name)
End If
Else
arr = Split(itm.ArtistName,";")
For j = 0 To UBound(arr)
dic.Item(Trim(arr(j))) = ""
Next
End If
Progress.Increase
SDB.ProcessMessages
If Progress.Terminate Then
Exit For
End If
Next
If SDB.VersionHi > 2 Then
arr = dic.Keys
Call SortArray(arr)
Progress.MaxValue = list.Count+dic.Count
For i = 0 To UBound(arr)
Call fout.WriteLine(arr(i))
Progress.Increase
SDB.ProcessMessages
If Progress.Terminate Then
Exit For
End If
Next
End If
fout.Close
If Not Progress.Terminate Then
Dim WShell : Set WShell = CreateObject("WScript.Shell")
i = WShell.Run(Chr(34)&path&Chr(34),1,0)
End If
End Sub
Sub SortArray(arr)
Call QuickSort(arr,LBound(arr),UBound(arr))
End Sub
Sub QuickSort(vec,loBound,hiBound)
Dim pivot,loSwap,hiSwap,temp
If hiBound - loBound = 1 Then
If Vec(loBound) > Vec(hiBound) Then
temp = Vec(loBound)
Vec(loBound) = Vec(hiBound)
Vec(hiBound) = temp
End If
End If
pivot = Vec(Int((loBound + hiBound) / 2))
Vec(Int((loBound + hiBound) / 2)) = Vec(loBound)
Vec(loBound) = pivot
loSwap = loBound + 1
hiSwap = hiBound
Do
While loSwap < hiSwap And Vec(loSwap) <= pivot
loSwap = loSwap + 1
WEnd
While Vec(hiSwap) > pivot
hiSwap = hiSwap - 1
WEnd
If loSwap < hiSwap then
temp = Vec(loSwap)
Vec(loSwap) = Vec(hiSwap)
Vec(hiSwap) = temp
End If
Loop While loSwap < hiSwap
Vec(loBound) = Vec(hiSwap)
Vec(hiSwap) = pivot
If loBound < (hiSwap - 1) Then
Call QuickSort(vec,loBound,hiSwap-1)
End If
If hiSwap + 1 < hibound Then
Call QuickSort(vec,hiSwap+1,hiBound)
End If
End Sub
Sub Install()
Dim inip : inip = SDB.ApplicationPath&"Scripts\Scripts.ini"
Dim inif : Set inif = SDB.Tools.IniFileByPath(inip)
If Not (inif Is Nothing) Then
inif.StringValue("JustListArtists","Filename") = "JustListArtists.vbs"
inif.StringValue("JustListArtists","Procname") = "JustListArtists"
inif.StringValue("JustListArtists","Order") = "2"
inif.StringValue("JustListArtists","DisplayName") = "Just List Artists"
inif.StringValue("JustListArtists","Description") = "Just List Artists"
inif.StringValue("JustListArtists","Language") = "VBScript"
inif.StringValue("JustListArtists","ScriptType") = "1"
SDB.RefreshScriptItems
End If
End Sub[/code]