How to add Script to Context menu?

This forum is for questions / discussions regarding development of addons / tweaks for MediaMonkey.

Moderator: Gurus

dtsig
Posts: 3003
Joined: Mon Jan 24, 2011 6:34 pm

How to add Script to Context menu?

Post by dtsig » Sat Jan 11, 2014 7:00 pm

I am looking for a sample 'stub' script which adds its name to the Context menu (right-click) and then can be executed. Anyone know of one?
Thanks
Where's the db and ini stored
Reporting Bugs
Where tags are stored

Not affiliated with MediaMonkey ... just a RABID user/lover
DTSig

trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Re: How to add Script to Context menu?

Post by trixmoto » Mon Jan 13, 2014 4:11 am

Yeah, some of my scripts definitely do this, but I can't think of one of the top of my head. I'll have a look later and let you know.
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.

trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Re: How to add Script to Context menu?

Post by trixmoto » Mon Jan 13, 2014 7:42 am

My "Randomise Playlist" script adds an item to the tree's context menu, and uses a it's own "ShowMenu" function to determine whether or not it should be visible...

Code: Select all

    Set itm = SDB.UI.AddMenuItem(SDB.UI.Menu_Pop_Tree,1,0)
    itm.Caption = "Randomise Playlist"
    itm.OnClickFunc = "ItmClick"
    itm.UseScript = Script.ScriptPath
    itm.IconIndex = 25  
    itm.Visible = False
    Set SDB.Objects("RandomisePlaylistMenu") = itm
    Call Script.RegisterEvent(SDB,"OnChangedSelection","ShowMenu")
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.

trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Re: How to add Script to Context menu?

Post by trixmoto » Mon Jan 13, 2014 7:45 am

My "Previewer" script adds an item to the Now Playing list's context menu and the main window's context menu...

Code: Select all

    Dim itm1 : Set itm1 = SDB.UI.AddMenuItem(SDB.UI.Menu_Pop_NP,0,0)
    itm1.Caption = "Previewer"
    itm1.OnClickFunc = "Toolbar"
    itm1.UseScript = SDB.ApplicationPath&"Scripts\Previewer.vbs"
    itm1.IconIndex = IconIndex
    Set SDB.Objects("Previewer-Menu1") = itm1
    Dim itm2 : Set itm2 = SDB.UI.AddMenuItem(SDB.UI.Menu_Pop_TrackList,0,0)
    itm2.Caption = "Preview this track"
    itm2.OnClickFunc = "Toolbar"
    itm2.UseScript = SDB.ApplicationPath&"Scripts\Previewer.vbs"
    itm2.IconIndex = IconIndex
    Set SDB.Objects("Previewer-Menu2") = itm2
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.

dtsig
Posts: 3003
Joined: Mon Jan 24, 2011 6:34 pm

Re: How to add Script to Context menu?

Post by dtsig » Mon Jan 13, 2014 11:40 am

Great .. thanks man. I will start studying these.
Where's the db and ini stored
Reporting Bugs
Where tags are stored

Not affiliated with MediaMonkey ... just a RABID user/lover
DTSig

Post Reply