Controlling MM5 from External Applications

From MediaMonkey Wiki
Jump to navigation Jump to search


A cross-platform way of controlling MM5 from external applications is via the Chrome Devtools API. You can find an explanation on how to use it with MediaMonkey here:

Windows Only

In addition to scripts that can be installed and run from within the application, MediaMonkey 5 exposes an API via the Microsoft COM model. This allows external applications to access and control MediaMonkey directly. These applications can be written in any language that can access COM objects. VBScript can be used to produce external scripts, but regular Visual Basic (or any COM-aware language) can be used as well, allowing for applications to gain access to MediaMonkey 5 without users needing to install addons.

In order to work with MediaMonkey 5's objects from an external script or application, you need to create a reference to the SDB object (short for SongsDB, an instance of the SDBApplication class) yourself. For .NET-based applications, you must also add a reference to MediaMonkey's COM object "MediaMonkey Library" to your Visual Studio project, so that the compiler can find MediaMonkey and the SongsDB5 namespace.

The SDBApplication class is largely unchanged from MediaMonkey 4, but the biggest difference is that it is named SongsDB5.SDBApplication instead of SongsDB.SDBApplication. If MediaMonkey is not running yet, it will be started and a reference will be returned. In addition, if MediaMonkey was not running before, it will normally shut down automatically when the external script/application exits. This can be prevented (so MediaMonkey will remain running) by setting SDB's ShutdownAfterDisconnect property to False.