spacefish wrote:I think your next update should include a .mmip installer. I'm lazy.![]()
Thanks for the great script!
Yeah. that's what I was thinking too. I just need to set up a file host for it...
spacefish wrote:I think your next update should include a .mmip installer. I'm lazy.![]()
Thanks for the great script!
onenonymous wrote:spacefish wrote:I think your next update should include a .mmip installer. I'm lazy.![]()
Thanks for the great script!
Yeah. that's what I was thinking too. I just need to set up a file host for it...
RedX wrote:I'd be happy to host it for you. Just send me the file
Regards,
Red
onenonymous wrote:Can you delete the script manually, then copy the code from the first post and save as usual? I want to rule out the installer routines as the cause of the problems. Thanks
' MediaMonkey Script
' NAME: RightClickForScripts
' AUTHOR: Onenonymous
' VERSION: 1.1a
' DATE: Feb 22, 2008
' UPDATE: Feb 25, 2008
' FORUM URL: http://www.mediamonkey.com/forum/viewtopic.php?t=26383&start=0
'
' This script places a new sub-menu in the menus when you right click on song(s)
' in the 4 pop-up menus (Main Window, Track List, Now Playing & Menu_Pop_Tree)
' It reads through the Scripts.ini file and loads any script of type 0 into the menus.
' To use, right click on a song, multiple songs or a node and find the new Scripts menu.
' Select one of the scripts from there. This is the same as if you chose the script from
' the Scripts menu under the Tools menu. Tested with MM3.
'
' INSTALL INSTRUCTIONS:
' 1) Save as RightClickForScripts.vbs in the Scripts\Auto directory
' 2) Some scripts will load in the right-click menu but won't actually work when run. This is due to
' a problem with those scripts when they call Script.ScriptPath. In this instance, the other
' script assumes that it's this script rather than the original one. If you try to run another scripts
' off the right-click menu and receive an error message that says:
' Error happened during script execution:
' Unknown name
' 3) If you receive the above error you will have to edit that other script to make it compatible with this one. To do so:
' a) Exit MM
' b) Open the other script in an editor such as notepad
' c) Add the 2 lines below(without the ' mark) at the beginning of the scripts
' after "Option Explicit" (if it exists) but before the first Sub or Function
'
' Dim sPath
' sPath = sdb.ApplicationPath & "Scripts\Filename.vbs" 'edit this to match the script you are updating
' d) Change the info in the second line above to match the script you are updating
' e.g. replace "Scripts\Filename.vbs" with the filename for the script you are changing
' if you are editing the file "somefile.vbs" in the Scripts\Auto folder,
' then it would be:
' sPath = sdb.ApplicationPath & "Scripts\Auto\somefile.vbs"
' e) Search for every instance of Script.ScriptPath in the other script and replace it with sPath
' e) Save the file, making sure it still has the .vbs extension.
'
Option Explicit
Public numScripts
numScripts = 0
if numScripts = 0 then
reDim mnuScript(99)
reDim mnuProc(99)
reDim mnuCaption(99)
reDim mnuHint(99)
Call ProcessScriptsIni
ReDim Preserve mnuScript(numScripts)
ReDim Preserve mnuProc(numScripts)
ReDim Preserve mnuCaption(numScripts)
ReDim Preserve mnuHint(numScripts)
call BubbleSort(mnuCaption)
end if
Sub OnStartUp()
Dim itm
Dim subItm
Dim i, j
For j = 1 To 4
'Add the menus to the 4 pop menus
Select Case j
Case 1
Set itm = sdb.UI.AddMenuItemSub(sdb.UI.Menu_Pop_NP_MainWindow, -1, -1)
sdb.UI.AddMenuItemSep sdb.UI.Menu_Pop_NP_MainWindow, -1, -2
Case 2
sdb.UI.AddMenuItemSep sdb.UI.Menu_Pop_TrackList, -1, -1
Set itm = sdb.UI.AddMenuItemSub(sdb.UI.Menu_Pop_TrackList, -1, -1)
Case 3
sdb.UI.AddMenuItemSep sdb.UI.Menu_Pop_NP, -1, -1
Set itm = sdb.UI.AddMenuItemSub(sdb.UI.Menu_Pop_NP, -1, -1)
Case 4
sdb.UI.AddMenuItemSep sdb.UI.Menu_Pop_Tree, -1, -1
Set itm = sdb.UI.AddMenuItemSub(sdb.UI.Menu_Pop_Tree, -1, -1)
End Select
itm.Caption = "Scripts"
For i = 1 To uBound(mnuCaption)
' now load each of the script menus
Set subItm = sdb.UI.AddMenuItem(itm, 0, 0)
With subItm
.Caption = mnuCaption(i)
.OnClickFunc = "DoMenu"
.UseScript = Script.ScriptPath
If mnuHint(i) <> "" Then .Hint = mnuHint(i)
End With
Next
Next
Set subItm = Nothing
Set itm = Nothing
End Sub
Sub DoMenu(o)
dim i
For i = 1 To uBound(mnuCaption)
' Do While (o.Caption <> mnuCaption(i))
If o.Caption = mnuCaption(i) Then
' msgbox mnuProc(i)
Script.include (sdb.ApplicationPath & "Scripts\" & mnuScript(i))
Execute (mnuProc(i))
exit sub
End If
Next
End Sub
Sub ProcessScriptsIni()
' Reads through Scripts.ini file to gather info on
' all scripts of type 0 (scripts that go into the 'scripts' menu).
Dim i, fso, iniF, iniPathedFileName, iniLine, ch, _
p, keyName, lcKeyName, sValue
Set fso = CreateObject("Scripting.FileSystemObject")
iniPathedFileName = sdb.ApplicationPath & "Scripts\Scripts.ini"
Set iniF = fso.OpenTextFile(iniPathedFileName, 1)
i = 1
' loop through all lines in file
Do While (Not iniF.AtEndOfStream)
iniLine = iniF.ReadLine
ch = Mid(iniLine, 1, 1)
If ((ch <> "") And (ch <> " ") And (ch <> ";") And (ch <> "[") And (ch <> "'")) Then
' process the line
p = InStr(iniLine, "=")
keyName = Mid(iniLine, 1, p - 1)
lcKeyName = LCase(keyName)
sValue = Trim(Mid(iniLine, p + 1))
Select Case lcKeyName
Case "filename"
mnuScript(i) = sValue
Case "procname"
mnuProc(i) = sValue
Case "displayname"
mnuCaption(i) = replace(sValue, "&", "")
Case "description"
mnuHint(i) = sValue
Case "scripttype"
'increment i each type we get a script type of 0
If sValue = 0 Then i = i + 1
End Select
End If
Loop
numscripts = i - 1
iniF.Close
Set iniF = Nothing
Set fso = Nothing
End Sub
Sub BubbleSort(List())
' Sorts an array using bubble sort algorithm
Dim First, Last
Dim i
Dim j
Dim Temp
First = LBound(List) + 1
Last = UBound(List)
For i = First To Last - 1
For j = i + 1 To Last
If List(i) > List(j) Then
Temp = List(j)
List(j) = List(i)
List(i) = Temp
Temp = mnuScript(j)
mnuScript(j) = mnuScript(i)
mnuScript(i) = Temp
Temp = mnuProc(j)
mnuProc(j) = mnuProc(i)
mnuProc(i) = Temp
Temp = mnuHint(j)
mnuHint(j) = mnuHint(i)
mnuHint(i) = Temp
Temp = ""
End If
Next
Next
End Sub
onenonymous wrote:one other thing to check - make sure you don't have another copy of the right click script still hanging around in Scripts/Auto. If you have one name slightly different from previous versions, it will likely conflict causing the double scripts to show up.
objRCFS_menu.IconIndex = SDB.RegisterIcon("Scripts\Auto\RightClickForScripts.ico", 0)
Users browsing this forum: No registered users and 25 guests