Page 1 of 8

ExternalTools v1.4 [MM2+3+4]

Posted: Thu Feb 15, 2007 8:39 pm
by Steegy
:: Script ExternalTools v1.4

This script provides a standard way of adding external tools/applications to MediaMonkey. These tools can use the tracks that are selected in MediaMonkey.
Some possible applications: external music players (e.g. Winamp), encoders (e.g. AAC Encoder), editors (e.g. mp3DirectCut, CoolEdit), ...

Installation Package: ExternalTools14.mmip

Screenshot (v1.4):

Options sheet:

Screenshots (v1.3):

Options sheet:

Toolbar submenu:

Context menus on tracklists and tree:

Version history/details:

Version 1.2 adds an option to set an icon for each tool.
It also adds a confirmation when a lot of applications (10 or more) are going to be started due to a lot of selected files for a tool with "for each selected track, use an instance", to avoid mistakes.

Version 1.3 lets you use the following field masks in the "Parameters" box:
%A --> ArtistName
%C --> Author
%G --> Genre
%L --> AlbumName
%M --> BPM
%R --> AlbumArtistName
%S --> Title
%T --> TrackOrder
%B --> Bitrate
%U --> Custom1
%V --> Custom2
%W --> Custom3
%Y --> Year

And these 3 (will automaticaly be quoted ' '):
%O --> Full path
%P --> Directory/folder (without ending \)
%F --> File name

Version 1.4 adds some minor bug fixes, MM Installation Package support, changed/added parameters: %O = full path, %P = directory/folder (without ending \), %F = file name

You can also specify parameter loops by using the syntax SomeText <LoopParameter:Separator> SomeOtherText
# serves as counter.


Resulting parameters conversions when 4 tracks are selected with artist ArtistX and title TrackX:
  • -titles "<%S: >" _means_ -titles "Title1 Title2 Title3 Title4"
  • -currentorfirsttitle "%S" -alltitles <"%S":,> _means_ -currentorfirsttitle "Title3" -alltitles "Title1","Title2","Title3","Title4"
  • -currentorfirsttitle %S <-title# %S: > _means_ -currentorfirsttitle Title3 -title1 Title1 -title2 Title2 -title3 Title3 -title4 Title4
  • <-title# %S: > <-artist# %A: > _means_ -title1 Title1 -title2 Title2 -title3 Title3 -title4 Title4 -artist1 Artist1 -artist2 Artist2 -artist3 Artist3 -artist4 Artist4
  • <-title# %S -artist# %A: > _means_ -title1 Title1 -artist1 Artist1 -title2 Title2 -artist2 Artist2 -title3 Title3 -artist3 Artist3 -title4 Title4 -artist4 Artist4
When "Run it for each selected track" is chosen (as supposed in the example), all parameters outside of a parameter loop will be taken from the executed instance (here the 3rd of the 4 tracks). So in this example the tool will be launched 4 times, for tracks 1, 2, 3, 4 (in the example the resulting parameters for the 3rd instance are shown).
E.g. for the 2nd example:
  • First instance's parameters: -currentorfirsttitle "Title1" -alltitles "Title1","Title2","Title3","Title4"
  • Second instance's parameters: -currentorfirsttitle "Title2" -alltitles "Title1","Title2","Title3","Title4"
  • Third instance's parameters: -currentorfirsttitle "Title3" -alltitles "Title1","Title2","Title3","Title4"
  • Fourth instance's parameters: -currentorfirsttitle "Title4" -alltitles "Title1","Title2","Title3","Title4"
When "Run it once" is chosen, the first track in the selection will be used (track 1). So the tool will only be run once, and in the example you have to replace Title3 (in red) with Title1.
E.g. for the 2nd example:
  • Only instance's parameters: -currentorfirsttitle "Title1" -alltitles "Title1","Title2","Title3","Title4"
When no tracks are selected, then the parameters and parameter loops will be omitted. Then the result would be:
  • -titles "<%S: >" _means_ -titles ""
  • -currentorfirsttitle "%S" -alltitles <"%S":,> _means_ -currentorfirsttitle "" -alltitles
  • -currentorfirsttitle %S <-title# %S: > _means_ -currentorfirsttitle
  • <-title# %S: > <-artist# %A: > _means_
  • <-title# %S -artist# %A: > _means_
In the future an extra option could be added to the tool specification, that at least one track must be selected for the tool to be launched. This would prevent launching a tool that expects selected tracks, when no tracks are selected.

If you have questions about this, feel free to ask here.

Posted: Thu Feb 15, 2007 9:45 pm
by Teknojnky
Very cool!

Posted: Thu Feb 15, 2007 10:53 pm
by pah68
Very Noice

Posted: Sat Jun 16, 2007 9:09 am
by Son of Spam
Okay, I see how the concept for implementing this script works.


I'm not as technical as I'd like to be.

When I click on "Add", nothing comes up.

And for "Name": is this my creation, ie. "Edit File In Audacity", for example?

And what do I put for "Parameters"?

Sorry to sound so ignorant. Like I said, I'm not very technical (but I can get by, lol!).

Posted: Sat Jun 16, 2007 9:16 am
by Son of Spam

I guess I'm not as dumb as I though I was. I restarted the Monkey, followed the instructions, and restarted again.

Works like a charm!

Posted: Sat Jun 16, 2007 9:28 am
by Eyal
Great tool utlity. :D
This will replace my 5 scripts, and it's easier and faster than going through the scripts menu.

Thank you Steegy.

Posted: Tue Jun 19, 2007 4:32 pm
by darchangel
In what language is this written? Would you be willing to make the source project available for download? As far as I can tell you are a C# dev'er and not too shabby of one at that. I'd love to look at your code and see how to interface with MM without going out of my skull. [see 'whack-a-mole' comment in thread: Events in .NET winforms: more of what works and what doesn't]

Posted: Tue Jun 19, 2007 5:32 pm
by Steegy
@darchangel: it's just a MM script written in VBScript. The exe program file is just the installer. Once it is installed in MM's Scripts folder, you can open the script file and edit it if you want. I know that this script is very basic (e.g. the configurations "look" is quite bad) so feel free to improve it if you want, but please keep things about it in this thread (btw: the installer script is quite basic, but if you want it I can give it).

Posted: Wed Jun 20, 2007 8:25 pm
by SHR
Your script is a great for adding external tools!

But there is just one thing, that I miss. I use your script to call e.g. MP3DirectCut. This works well for just one track, but causes sometimes errors when multiple tracks are selected. So do you plan to add a call-this-tool-for-each-track-function?

Posted: Thu Jun 21, 2007 5:38 am
by Steegy
Some programs (like Winamp; or all?) give errors when they are given a lot of file names as command line parameters.
Sometimes it's possible to call the program multiple times after each other, everytime using another file name, but sometimes this isn't what someone wants. (some programs would open multiple instances when just 1 instance in wanted, ...)
I haven't found a solution yet to the "multiple file paths as command line parameters" issue. Maybe it's just the length of the command line that is limited.

But what you suggest is very good possible (but as I said above, it doesn't solve the problem is all cases).

Posted: Thu Jun 21, 2007 8:59 am
by Steegy
I uploaded a new version that can be downloaded from the first post. Feel free to give better wordings for the "selected tracks" choices.

Posted: Fri Jun 22, 2007 3:10 am
by SHR
You are right. Long commandlines are an issue and not always I want multiple instances. So I think, that there is no general way to handle it. But some programs know some kind of ADD-Parameter e.g. other player with playlists or tab/window-support. Or it is possible to limit these programs to one instance as an option. So your script can now call to append the tracks to the existing instance one by one. (not always nice, but still works) The new feature to call different instances is very good for me, as e.g. MP3DirectCut or some converter can handle only one file per instance. Although there is an issue for me with calling e.g. 100! instances. (But who wants to do this :wink:) Maybe a limit and or limitcheck can help to avoid unwanted lockups with calling the script more than x-times.

Meanwhile I played around with your script and implemented the new feature in nearly the same way (radiobuttons, etc.). Except for the setting of a calllimit with a warning. :D But there aren't so much ways to do this. Right?!

Anyway thanks for the new version and the quick response.

BTW: How about assigning own icons to the Tools in the toolbar?

Posted: Sat Jun 23, 2007 5:01 pm
by drogba
Steegy,what skin is that from?
you wouldn't mind posting a link

Posted: Sat Jun 23, 2007 5:52 pm
by Steegy
SHR wrote:Maybe a limit and or limitcheck can help to avoid unwanted lockups with calling the script more than x-times.
BTW: How about assigning own icons to the Tools in the toolbar?
Good suggestions, both things have been implemented in v1.2. The default warning threshold for starting applications is 10. So when 10 or more selected tracks would cause that many application instances to be started (e.g. of mp3DirectCut), then a confirmation will be asked.
drogba wrote:Steegy,what skin is that from?
See the skins Wiki page or the skin's forum page.

Posted: Sat Jul 14, 2007 11:38 pm
by BMF
I am using the script for quite a while now. I prelisten to songs over earphones with another program (VLC) which is connected to a second sound card. Learning more about the monkey itself i am starting to use the "virtual cd" option to keep my library in order and avoid double entries. Now the following occurs: when i like to prelisten to a song that is stored in a virtual cd nothing happens. the vlc opens but doesn't play the selected song. I wonder if i may add special parameters for this kind of situation, but i am not familiar with it. so i would appreciate kindly hints :).