Right Click for Scripts -with buttons! (2008-09-07) [MM3]

Download and get help for different MediaMonkey for Windows 4 Addons.

Moderators: Peke, Gurus

onenonymous
Posts: 374
Joined: Sat Feb 02, 2008 1:09 pm
Location: Texas

Post by onenonymous »

spacefish wrote:I think your next update should include a .mmip installer. I'm lazy. :lol:

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
Posts: 366
Joined: Wed Dec 27, 2006 10:32 am
Location: Germany

Post by RedX »

onenonymous wrote:
spacefish wrote:I think your next update should include a .mmip installer. I'm lazy. :lol:

Thanks for the great script!
Yeah. that's what I was thinking too. I just need to set up a file host for it...
I'd be happy to host it for you. Just send me the file per email:
grim.fandango.2501@googlemail.com

Regards,
Red
onenonymous
Posts: 374
Joined: Sat Feb 02, 2008 1:09 pm
Location: Texas

Post by onenonymous »

RedX wrote:I'd be happy to host it for you. Just send me the file
Regards,
Red
Thanks, I've got it set up now.
One~
onenonymous
Posts: 374
Joined: Sat Feb 02, 2008 1:09 pm
Location: Texas

Post by onenonymous »

Fixed a bug and created an installer. See first post for new code.

Version 1.21 Update March 16, 2008
-Created an installer file
-Fixed a bug that errored the 2nd time some scripts were run off the right-click menu
nynaevelan
Posts: 5559
Joined: Wed Feb 07, 2007 11:07 pm
Location: New Jersey, USA
Contact:

Post by nynaevelan »

I get the following error when opening MM, then when it opens my scripts appear on the menu twice:

Image

Nyn
3.2x - Win7 Ultimate (Zen Touch 2 16 GB/Zen 8GB)
Link to Favorite Scripts/Skins

Join Dropbox, the online site to share your files
onenonymous
Posts: 374
Joined: Sat Feb 02, 2008 1:09 pm
Location: Texas

Post by onenonymous »

hmm - I'll look into it. Your screen shot is a bit fuzzy - is that line 133?

If you re-start MM - does it still error?
nynaevelan
Posts: 5559
Joined: Wed Feb 07, 2007 11:07 pm
Location: New Jersey, USA
Contact:

Post by nynaevelan »

Yes, it is line 133 and it will let me continue into MM once I click ok, then I'll get two send error report boxes and all is ok. And yes it happens each time I open MM, tried three times.

Nyn
3.2x - Win7 Ultimate (Zen Touch 2 16 GB/Zen 8GB)
Link to Favorite Scripts/Skins

Join Dropbox, the online site to share your files
onenonymous
Posts: 374
Joined: Sat Feb 02, 2008 1:09 pm
Location: Texas

Post by onenonymous »

Thanks for being my bug checker again :-?

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
drjboulder
Posts: 1119
Joined: Mon Apr 09, 2007 12:03 am
Location: Boulder, Colorado, USA

Post by drjboulder »

Been meaning to post about the same thing.
My error code is a different line number, tho:

Image

Happens every time. Script works fine after clicking through and the monkey has opened.
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
I will try that now.
D Rock
Image
MediaMonkeyGoldv3.0.3.1183
Vista Home Basic|4thGen 20GPod
Zune Small Player Skin w/ Aqua 4 Player Mod
Backup | Last FM Node | Scrobbler DJ | TopTracks | StayInSameStyleDJ
RadioDJ | RadioFreeMonkey | PrettyPictures | MiniLyricsEmbedder
LyricsViewer | Lyricator | LyricsPlugin | VisualizationEmbedder | MonkeyRok
RightClickForWeb | WebSearchPanels | WebNodes | MagicNodes | FavoritesNodes
NowPlayingArtNode |AutoRateAccurate | TaggingInconsistencies
AdvancedDuplicateFind&Fix | CaseModify | PlayHistory&Stats | Etc...
nynaevelan
Posts: 5559
Joined: Wed Feb 07, 2007 11:07 pm
Location: New Jersey, USA
Contact:

Post by nynaevelan »

Manually installing does not remove the error on the double posting on the menu.

Nyn
3.2x - Win7 Ultimate (Zen Touch 2 16 GB/Zen 8GB)
Link to Favorite Scripts/Skins

Join Dropbox, the online site to share your files
drjboulder
Posts: 1119
Joined: Mon Apr 09, 2007 12:03 am
Location: Boulder, Colorado, USA

Post by drjboulder »

When I manually installed, I got Bug report windows - "OLE error 80020102", Then error message about not being able to open RandomizePlaylist.vbs.
:-? Think I liked the install package errors better.
D Rock
Image
MediaMonkeyGoldv3.0.3.1183
Vista Home Basic|4thGen 20GPod
Zune Small Player Skin w/ Aqua 4 Player Mod
Backup | Last FM Node | Scrobbler DJ | TopTracks | StayInSameStyleDJ
RadioDJ | RadioFreeMonkey | PrettyPictures | MiniLyricsEmbedder
LyricsViewer | Lyricator | LyricsPlugin | VisualizationEmbedder | MonkeyRok
RightClickForWeb | WebSearchPanels | WebNodes | MagicNodes | FavoritesNodes
NowPlayingArtNode |AutoRateAccurate | TaggingInconsistencies
AdvancedDuplicateFind&Fix | CaseModify | PlayHistory&Stats | Etc...
onenonymous
Posts: 374
Joined: Sat Feb 02, 2008 1:09 pm
Location: Texas

Post by onenonymous »

I think the line numbers are actually lines in the other scripts. Not sure why though as it works well on my machine. I'll dig into it. In the meantime, here's the previous version if you want to revert :oops:

Code: Select all

' 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
Posts: 374
Joined: Sat Feb 02, 2008 1:09 pm
Location: Texas

Post by onenonymous »

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.
nynaevelan
Posts: 5559
Joined: Wed Feb 07, 2007 11:07 pm
Location: New Jersey, USA
Contact:

Post by nynaevelan »

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.
That is exactly what was causing my double-posts, I was hoping it was the cause of the error on startup but no such luck. :oops:

Nyn
3.2x - Win7 Ultimate (Zen Touch 2 16 GB/Zen 8GB)
Link to Favorite Scripts/Skins

Join Dropbox, the online site to share your files
onenonymous
Posts: 374
Joined: Sat Feb 02, 2008 1:09 pm
Location: Texas

Post by onenonymous »

Please try commenting out the following line:

Code: Select all

objRCFS_menu.IconIndex = SDB.RegisterIcon("Scripts\Auto\RightClickForScripts.ico", 0)
let me know if this helps :cry:

If it does work, I've modified code and reloaded the installer on the first page. If it doesn't work, then I'll keep looking... :oops:
Post Reply