Adding buttons to a script ?

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

arcspin
Posts: 48
Joined: Wed Nov 22, 2006 3:12 pm
Contact:

Adding buttons to a script ?

Post by arcspin »

God morning to you all,
Is there a way to easely add a button to a script or a node?
Or add a button at all?

For example if a have a modify track script that I use freqently and I wish to acces that by clicking a button instead of going thru the Tools/scrpits menu.
Or
I have a magic node that I wish to come back to, it would be sweet to just have to click a button and the tree structure folds back to that particular magic node.

Well, just some thoughts I had this morning... have a nice day

//Peter
DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo »

There are two kinds script types basically.
Those that goes in the \Scripts\Auto folder and those that goes in the \Scripts\ folder

Those in the \scripts\ folder usually have a section in the \Scripts\Scripts.ini file.

If it is one of those you could do something like this

Code: Select all

Sub OnStartup
    With SDB.UI.AddMenuItem(SDB.UI.Menu_TbStandard, 0, 0)
        .Caption="My Button to Script"
        .IconIndex=52
        .UseScript=Script.ScriptPath
        .OnClickFunc="DoStuffInOtherScript"
    End With
End Sub

Sub DoStuffInOtherScript(o)
    Script.Include "C:\Program Files\MediaMonkey\Scripts\SomeScript.vbs"
    SubInScript
End Sub
SubInScript is the sub name of the script, revealed in the scripts.ini like
ProcName=ExportCSV for example

The above could be put under the \Auto\ folder, and you call it something ending with .vbs. I believe the above should work.
Image
arcspin
Posts: 48
Joined: Wed Nov 22, 2006 3:12 pm
Contact:

Post by arcspin »

OK, This will be interesting to try out. :roll:

I do however have zero knowledge in scrpiting/programming, I'll better back up my files before I wander into the dark forrest of scripting...

Thank you for the tutorial

//P
DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo »

It was kind of general question. If you're more specific with what script you want a to have an easy button added to, I'm sure you'll get a 'DIY' flat pack, with allen key included..
Image
arcspin
Posts: 48
Joined: Wed Nov 22, 2006 3:12 pm
Contact:

If so, then...

Post by arcspin »

Hey,
Trixmoto have made this awsome scrpit that lets you preview a song without interuping the current playlist.
That is a script that I would love a button attached to.
http://www.mediamonkey.com/forum/viewto ... =previewer


Merry X-mas
//P
DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo »

I see Trixmoto have added a keyboard shortcut being Shift+Alt+P.

That script above should look something like this to work with Trixmoto's Previewer. Maybe he'll consider doing a button as a feature in the next version.

Make a new notepad document, copy the code to it, and save it to your \Scripts\Auto folder.
Use " (double quotes) in front and at the end of the file name when you save, like "PreviewerButton.vbs"

Code: Select all

'\MediaMonkey\Scripts\Auto\PreviewerButton.vbs
Sub OnStartup
    With SDB.UI.AddMenuItem(SDB.UI.Menu_TbStandard, 0, 0)
        .Caption="Previewer"
        .IconIndex=50
        .UseScript=Script.ScriptPath
        .OnClickFunc="DoStuff"
    End With
End Sub

Sub DoStuff(o)
     Script.Include SDB.ApplicationPath & "Scripts\Previewer.vbs"
     Previewer
End Sub
Revised code. Should add a speaker icon to your toolbar called Previewer after restarting MM.
Image
arcspin
Posts: 48
Joined: Wed Nov 22, 2006 3:12 pm
Contact:

MAGIC

Post by arcspin »

Hey DiddeLeeDoo,
Wouderfull!

This is truly magic, I past some text into notepad and like magic a button appears in MM.

I'm so glad you guys take the time and help people like me out, without you MM would not be the best manager out there !!

Thanx again,

(I'm sure I will come back when I need more favours from you magicians)

//P
chaussettdeguerr
Posts: 14
Joined: Thu Jul 19, 2007 7:58 am
Location: belgium
Contact:

Post by chaussettdeguerr »

really wonderful diddeleedoo
thanks a lot
The Crow
Posts: 44
Joined: Wed Nov 28, 2007 4:05 pm
Contact:

Post by The Crow »

Any chance of getting the PreviewerButton script working with the actual version of Previewer script? At the moment the PreviewerButton script can't handle the -30s, -5s, Pause...-buttons.
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

You need to add this...

Code: Select all

Sub OnStartup
    With SDB.UI.AddMenuItem(SDB.UI.Menu_TbStandard, 0, 0)
        .Caption="Previewer"
        .IconIndex=50
        .UseScript=Script.ScriptPath
        .OnClickFunc="DoPreviewer"
    End With
End Sub

Sub DoPreviewer(obj)
  Call Previewer
End Sub 
...above the "Previewer" sub procedure and move the file to the Auto folder. You'll then need to amend the file path in the Scripts.ini file if you want to use the menu bar as well.
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.
The Crow
Posts: 44
Joined: Wed Nov 28, 2007 4:05 pm
Contact:

Post by The Crow »

Excellent! Thanks!

By the way, is it possible to get the button displayed in party mode as well? That would be nice but it doesn't greatly matter.
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

Well the button appears on the standard toolbar, is this not visible in party mode? Are there any toolbars which do?
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.
The Crow
Posts: 44
Joined: Wed Nov 28, 2007 4:05 pm
Contact:

Post by The Crow »

The standard tool-bar is visible only partly: The edit and the three play-buttons are displayed. As the remaining buttons (Visualization,...) are inaccessible as well, I don't think it's possible to modify this party mode setting.
However it's possible to set a hotkey which is available in party mode.

PS: I just noticed another behaviour: When running Previewer script by hotkey the interrupted song always restarts from the beginning. Starting the script by Tools/Scripts or the "Previewer button" works fine.
-SuperFunk-
Posts: 45
Joined: Tue Aug 05, 2008 4:16 pm
Contact:

Re: Adding buttons to a script ?

Post by -SuperFunk- »

Hey guys,
interesting topic here, it has to do with my problem
I tried to understand the programming-code but i don't know nothing about that, so my question is if somebody could help me to create a Shortcut for 3 scripts i Use a Lot:

1. PersonalTagEnhancer
http://www.mediamonkey.com/forum/viewto ... agenhancer
2. Auto-Increment TrackNumbers
and
3. The Case checker

I would appreciate any help :)
onenonymous
Posts: 374
Joined: Sat Feb 02, 2008 1:09 pm
Location: Texas
Contact:

Re: Adding buttons to a script ?

Post by onenonymous »

-SuperFunk- wrote:Hey guys,
interesting topic here, it has to do with my problem
I tried to understand the programming-code but i don't know nothing about that, so my question is if somebody could help me to create a Shortcut for 3 scripts i Use a Lot ...
I'm working on an update to my Right Click for Scripts (link is in my signature) that will allow you to create a toolbar button for any of the scripts available off my Right Click menus. I think the 3 scripts you mentioned would be in that category. I'm hoping to have first beta done to post this weekend. If all you want is Right Click access to those scripts, then my script will do it. If you want a button, then wait for my update.
~One
Post Reply