How to add Script to Context menu?

Post a reply

Smilies
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: How to add Script to Context menu?

Re: How to add Script to Context menu?

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

Great .. thanks man. I will start studying these.

Re: How to add Script to Context menu?

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

Re: How to add Script to Context menu?

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")

Re: How to add Script to Context menu?

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.

How to add Script to Context menu?

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

Top