Page 1 of 2

Adding buttons to a script ?

Posted: Sun Dec 03, 2006 3:15 am
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

Posted: Sun Dec 03, 2006 4:26 am
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.

Posted: Sun Dec 03, 2006 6:34 am
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

Posted: Sun Dec 03, 2006 6:48 am
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..

If so, then...

Posted: Sun Dec 03, 2006 7:52 am
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

Posted: Sun Dec 03, 2006 8:20 am
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.

MAGIC

Posted: Sun Dec 03, 2006 1:26 pm
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

Posted: Thu Jul 19, 2007 3:27 pm
by chaussettdeguerr
really wonderful diddeleedoo
thanks a lot

Posted: Sun Jan 06, 2008 6:17 am
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.

Posted: Mon Jan 07, 2008 4:44 am
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.

Posted: Mon Jan 07, 2008 6:13 pm
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.

Posted: Tue Jan 08, 2008 4:36 am
by trixmoto
Well the button appears on the standard toolbar, is this not visible in party mode? Are there any toolbars which do?

Posted: Tue Jan 08, 2008 8:45 am
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.

Re: Adding buttons to a script ?

Posted: Tue Aug 05, 2008 4:24 pm
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 :)

Re: Adding buttons to a script ?

Posted: Tue Aug 05, 2008 6:28 pm
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