This is a script that adds a toolbar menu to support "More from the same..." (Artist, Album, Genre, Year, FolderLibrary, FolderMyComputer, FolderExplorer).
UPDATE: Added FULL support (also FolderLibrary, FolderMyComputer, FolderExplorer) and changed the toolbar icon.
REMARKS:
- Just a minor problem that you can't MoreFromFolderLibrary when you're in the My Computer tree. This could be solved by using DB SQL, but I suspect a bug in MM that causes this behaviour. (I'm not implementing a workaround for now)
- Might give problems for tracks on CD's or Network. I haven't tested that yet.
- Because the strange icon implementation in MM, the 3 folder icons are simply a folder. (I couldn't use the normal icons without adding them manually to the program).
Code: Select all
'==========================================================================
'
' MediaMonkey Script
'
' NAME: Toolbar_MoreFromTheSame v1.1
' DESCRIPTION:
' Adds a toolbar menu (light bulb icon) to support "More from the same..."
' (Artist, Album, Genre, Year, FolderLibrary, FolderMyComputer, FolderExplorer).
'
' AUTHOR: Steegy aka RC
' DATE : 29.11.2005
'
' INSTALL:
' - Copy script to MM directory scripts\auto
'
'==========================================================================
Dim lcNothingToSend
Dim MyMoreTBB, MyMoreArtist, MyMoreAlbum, MyMoreGenre, MyMoreYear, MyMoreFolderLibrary, MyMoreFolderMyComputer, MyMoreFolderExplorer
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
' Variable Configuration: Localise this if necessary
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
'
' Dutch Localisation ;)
lcNothingToSend = "Er is niets geselecteerd."
lcNotPossibleFromMyComputer = "Dit is onmogelijk vanuit 'Deze Computer'"
'lcNothingToSend = "Nothing selected."
'lcNotPossibleFromMyComputer = "This isn't possible from within a 'My Computer' tree."
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
' Here's the code
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
'
Sub onStartUp
SDB.UI.AddMenuItemSep SDB.UI.Menu_TbStandard,0,0
Set MyMoreTBB = SDB.UI.AddMenuItemSub(SDB.UI.Menu_TbStandard,0,0)
MyMoreTBB.Caption = SDB.Localize("&Find More from Same")
MyMoreTBB.OnClickFunc = "CheckAvailability"
MyMoreTBB.UseScript = Script.ScriptPath
MyMoreTBB.IconIndex = 19
Set MyMoreArtist = SDB.UI.AddMenuItem(MyMoreTBB,0,0)
MyMoreArtist.Caption = SDB.Localize("Artist")
MyMoreArtist.OnClickFunc = "MoreArtist"
MyMoreArtist.UseScript = Script.ScriptPath
MyMoreArtist.IconIndex = 60
Set MyMoreAlbum = SDB.UI.AddMenuItem(MyMoreTBB,0,0)
MyMoreAlbum.Caption = SDB.Localize("Album")
MyMoreAlbum.OnClickFunc = "MoreAlbum"
MyMoreAlbum.UseScript = Script.ScriptPath
MyMoreAlbum.IconIndex = 57
Set MyMoreGenre = SDB.UI.AddMenuItem(MyMoreTBB,0,0)
MyMoreGenre.Caption = SDB.Localize("Genre")
MyMoreGenre.OnClickFunc = "MoreGenre"
MyMoreGenre.UseScript = Script.ScriptPath
MyMoreGenre.IconIndex = 58
Set MyMoreYear = SDB.UI.AddMenuItem(MyMoreTBB,0,0)
MyMoreYear.Caption = SDB.Localize("Year")
MyMoreYear.OnClickFunc = "MoreYear"
MyMoreYear.UseScript = Script.ScriptPath
MyMoreYear.IconIndex = 59
Set MyMoreFolderLibrary = SDB.UI.AddMenuItem(MyMoreTBB,0,0)
MyMoreFolderLibrary.Caption = SDB.Localize("Folder (&Library)")
MyMoreFolderLibrary.OnClickFunc = "MoreFolderLibrary"
MyMoreFolderLibrary.UseScript = Script.ScriptPath
MyMoreFolderLibrary.IconIndex = 70
Set MyMoreFolderMyComputer = SDB.UI.AddMenuItem(MyMoreTBB,0,0)
MyMoreFolderMyComputer.Caption = SDB.Localize("Folder (&Computer)")
MyMoreFolderMyComputer.OnClickFunc = "MoreFolderMyComputer"
MyMoreFolderMyComputer.UseScript = Script.ScriptPath
MyMoreFolderMyComputer.IconIndex = 70
Set MyMoreFolderExplorer = SDB.UI.AddMenuItem(MyMoreTBB,0,0)
MyMoreFolderExplorer.Caption = SDB.Localize("Folder (&Explorer)")
MyMoreFolderExplorer.OnClickFunc = "MoreFolderExplorer"
MyMoreFolderExplorer.UseScript = Script.ScriptPath
MyMoreFolderExplorer.IconIndex = 70
SDB.Objects("MyMoreTBB") = MyMoreTBB
SDB.Objects("MyMoreArtist") = MyMoreArtist
SDB.Objects("MyMoreAlbum") = MyMoreAlbum
SDB.Objects("MyMoreGenre") = MyMoreGenre
SDB.Objects("MyMoreYear") = MyMoreYear
SDB.Objects("MyMoreFolderLibrary") = MyMoreFolderLibrary
SDB.Objects("MyMoreFolderMyComputer") = MyMoreFolderMyComputer
SDB.Objects("MyMoreFolderExplorer") = MyMoreFolderExplorer
End Sub
Function CheckValid(WhatToCheck)
If "" & WhatToCheck = "" Or "" & WhatToCheck = "0" Then
Exit Function
End If
CheckValid = True
End Function
Function CheckAvailability(arg)
Dim list
Set list = SDB.CurrentSongList
If list.count = 0 Then
SDB.Objects("MyMoreArtist").Enabled = False
SDB.Objects("MyMoreAlbum").Enabled = False
SDB.Objects("MyMoreGenre").Enabled = False
SDB.Objects("MyMoreYear").Enabled = False
SDB.Objects("MyMoreFolderLibrary").Enabled = False
SDB.Objects("MyMoreFolderMyComputer").Enabled = False
SDB.Objects("MyMoreFolderExplorer").Enabled = False
Else
SDB.Objects("MyMoreArtist").Enabled = CheckValid(list.item(0).ArtistName)
SDB.Objects("MyMoreAlbum").Enabled = CheckValid(list.item(0).AlbumName)
SDB.Objects("MyMoreGenre").Enabled = CheckValid(list.item(0).Genre)
SDB.Objects("MyMoreYear").Enabled = CheckValid(list.item(0).Year)
SDB.Objects("MyMoreFolderLibrary").Enabled = True
SDB.Objects("MyMoreFolderMyComputer").Enabled = True
SDB.Objects("MyMoreFolderExplorer").Enabled = True
End If
End Function
Sub MoreArtist(arg)
ChooseMore("Artist")
End Sub
Sub MoreAlbum(arg)
ChooseMore("Album")
End Sub
Sub MoreGenre(arg)
ChooseMore("Genre")
End Sub
Sub MoreYear(arg)
ChooseMore("Year")
End Sub
Sub MoreFolderLibrary(arg)
ChooseMore("FolderLibrary")
End Sub
Sub MoreFolderMyComputer(arg)
ChooseMore("FolderMyComputer")
End Sub
Sub MoreFolderExplorer(arg)
ChooseMore("FolderExplorer")
End Sub
Function ChooseMore(MyChoice)
Dim Result, list, MyLocation
Set list = SDB.CurrentSongList
If list.count = 0 Then
Result = SDB.MessageBox(lcNothingToSend, mtError, Array(mbOK))
Exit Function
End If
'Result = SDB.MessageBox(list.item(0).Media.MediaLabel, mtError, Array(mbOK))
Dim MyChooseMore
Dim Node2B
Dim MyChooseNode
Select Case MyChoice
Case "Artist":
Set MyChooseNode = SDB.MainTree.Node_Artist
MyChooseMore = list.item(0).ArtistName
Case "Album":
Set MyChooseNode = SDB.MainTree.Node_Album
If list.item(0).AlbumArtistName = "" Then
MyChooseMore = list.item(0).AlbumName
Else
MyChooseMore = list.item(0).AlbumName & " (" & list.item(0).AlbumArtistName & ")"
End If
Case "Genre":
Set MyChooseNode = SDB.MainTree.Node_Genre
MyChooseMore = list.item(0).Genre
Case "Year":
Set MyChooseNode = SDB.MainTree.Node_Year
MyChooseMore = Left(list.item(0).Year,3) & "0's"
MyYear = "" & list.item(0).Year
Case "FolderLibrary":
If list.item(0).Media.DriveType = 0 Then
Result = SDB.MessageBox(lcNotPossibleFromMyComputer, mtError, Array(mbOK))
Exit Function
End If
Set MyChooseNode = SDB.MainTree.Node_Location
MyLocation = Split(list.item(0).Path,"\")
Select Case list.item(0).Media.DriveType
Case 2,3,4:
MyChooseMore = "HD:" & list.item(0).Media.MediaLabel & " (" & MyLocation(0) & ")"
Case 5:
MyChooseMore = "CD:Audio CD"
Case 12345:
MyChooseMore = SDB.Localize("Network")
End Select
Case "FolderMyComputer":
Set MyChooseNode = SDB.MainTree.Node_MyComputer
MyLocation = Split(list.item(0).Path,"\")
Select Case list.item(0).Media.DriveType
Case 2,3,4:
If list.item(0).Media.MediaLabel = "" Then
MyChooseMore = MyLocation(0) & "\"
Else
MyChooseMore = MyLocation(0) & "\ [" & list.item(0).Media.MediaLabel & "]"
End If
Case 5:
If list.item(0).Media.MediaLabel = "" Then
MyChooseMore = MyLocation(0) & "\"
Else
MyChooseMore = MyLocation(0) & "\ [" & list.item(0).Media.MediaLabel & "]"
End If
Case 12345:
MyChooseMore = SDB.Localize("Network")
End Select
'Result = SDB.MessageBox(MyChooseMore, mtError, Array(mbOK))
Case "FolderExplorer":
Command = "explorer " & Left(list.item(0).Path, InStrRev(list.item(0).Path, "\"))
Set WShell = CreateObject("WScript.Shell")
Result = WShell.Run(Command, 1, False)
Exit Function
End Select
'Result = SDB.MessageBox(MyChooseMore, mtError, Array(mbOK))
'Result = SDB.MessageBox(list.item(0).Media.DriveType & " TTT" & MyChooseMore, mtError, Array(mbOK))
If Not CheckValid(MyChooseMore) Then
Exit Function
End If
MyChooseNode.Expanded = True
Set Node2B = SDB.MainTree.FirstChildNode(MyChooseNode)
If Not Node2B.Caption = MyChooseMore Then
Do
Set Node2B = SDB.MainTree.NextSiblingNode(Node2B)
'Result = SDB.MessageBox(Node2B.Caption, mtError, Array(mbOK))
Loop While Node2B.Caption <> MyChooseMore
End If
If MyChoice = "Year" Then
Node2B.Expanded = True
Set Node2B = SDB.MainTree.FirstChildNode(Node2B)
If Not Node2B.Caption = MyYear Then
Do
Set Node2B = SDB.MainTree.NextSiblingNode(Node2B)
'Result = SDB.MessageBox(Node2B.Caption, mtError, Array(mbOK))
Loop While Node2B.Caption <> MyYear
End If
End If
If MyChoice = "FolderLibrary" Then
i = 1
Do While i < UBound(MyLocation)
Node2B.Expanded = True
'Result = SDB.MessageBox(Node2B.Caption, mtError, Array(mbOK))
Set Node2B = SDB.MainTree.FirstChildNode(Node2B)
'Result = SDB.MessageBox(Node2B.Caption, mtError, Array(mbOK))
If Not Node2B.Caption = MyLocation(i) Then
Do
Set Node2B = SDB.MainTree.NextSiblingNode(Node2B)
'Result = SDB.MessageBox(Node2B.Caption, mtError, Array(mbOK))
Loop While Node2B.Caption <> MyLocation(i)
End If
i = i + 1
Loop
End If
If (MyChoice = "FolderMyComputer" Or MyChoice = "FolderMyComputer") Then
i = 1
Do While i < UBound(MyLocation)
Node2B.Expanded = True
'Result = SDB.MessageBox(Node2B.Caption, mtError, Array(mbOK))
Set Node2B = SDB.MainTree.FirstChildNode(Node2B)
'Result = SDB.MessageBox(Node2B.Caption, mtError, Array(mbOK))
If Not Node2B.Caption = MyLocation(i) Then
Do
Set Node2B = SDB.MainTree.NextSiblingNode(Node2B)
'Result = SDB.MessageBox(Node2B.Caption, mtError, Array(mbOK))
Loop While Node2B.Caption <> MyLocation(i)
End If
i = i + 1
Loop
End If
SDB.MainTree.CurrentNode = Node2B
End Function
Steegy