[Solved] How to add script to media tree context menu?

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

Moderators: Gurus, Addon Administrators

pokeefe0001
Posts: 97
Joined: Thu Oct 11, 2018 4:48 pm
Location: USA, Pacific Northwest

[Solved] How to add script to media tree context menu?

Post by pokeefe0001 »

This is a spinoff from my thread viewtopic.php?f=19&t=100743&e=1&view=unread#unread

How do I get a script added to the context menu used by the Media Tree? I know this can be done because Zvezdan Dimitrijevic does it in the ExportM3UsForSubNodes script. However, that script is "compressed - using : instead of newline - so it's very hard to read. I searched it to "context" but there was no hit.

Is there any other, more easily read script that adds itself to the context menu?
Last edited by pokeefe0001 on Sat Dec 18, 2021 7:41 pm, edited 1 time in total.
MMV4 (1919) Portable
MMW5 (2606) Portable
Multiple Win11 x64 21H2
Multiple Win7 x32, unknown builds
Erwin Hanzl
Posts: 1189
Joined: Tue Jun 13, 2017 8:47 am
Location: Vienna

Re: How to add script to media tree context menu?

Post by Erwin Hanzl »

CustomFieldsTagger
https://www.mediamonkey.com/addons/brow ... ldstagger/

No script is easy to read.
MMW 4.1.31.1919 Gold-Standardinstallation
pokeefe0001
Posts: 97
Joined: Thu Oct 11, 2018 4:48 pm
Location: USA, Pacific Northwest

Re: How to add script to media tree context menu?

Post by pokeefe0001 »

Erwin Hanzl wrote: Fri Dec 10, 2021 11:00 am No script is easy to read.
True, but the script I mentioned uses a colon as line separator making it nearly impossible to read unedited. This could be to make for a shorter file to download, but I think it's also for obfuscation. The script uses an apparently random mix of upper and lower case letters which, as near as I can tell, serves no purpose other than to make it difficult to read.

Anyway, if I understand the question I was asking, I actually had the answer 4 months ago. I had already added a script to the File context menu. For this latest script I put the following in the Auto scripts folder.

Code: Select all

Sub OnStartup

    With SDB.UI.AddMenuItem(SDB.UI.Menu_File, 2, 3)
        .Caption="Import SBD M3U playlist " 
        .UseScript=Script.ScriptPath
        .OnClickFunc="InnerInvocation"
        .IconIndex=57
    End With
End Sub

Sub includeFile(fSpec)
    With CreateObject("Scripting.FileSystemObject")
       executeGlobal .openTextFile(fSpec).readAll()
    End With
End Sub

Sub InnerInvocation(Load)

includeFile(SDB.ScriptsPath & "ImportSBDM3U.vbs")
ImportSBDM3U
End Sub
I have no idea if that is the way we're supposed to do it, but it works.
This is also an answer to the viewtopic.php?f=19&t=99602
("Any way to execute a type=0 script that isn't in scritps.ini?")
thread I posted last July.
MMV4 (1919) Portable
MMW5 (2606) Portable
Multiple Win11 x64 21H2
Multiple Win7 x32, unknown builds
Post Reply