View Issue Details

IDProjectCategoryView StatusLast Update
0017617MediaMonkey 5Extensions frameworkpublic2021-03-16 20:25
Reporterzvezdan Assigned To 
PrioritynoneSeverityminorReproducibilityhave not tried
Status newResolutionopen 
Summary0017617: Using COM objects in JavaScript
DescriptionI know it is possible using ActiveX/COM objects in JScript, but not in JavaScript. Could you add support for COM objects? Or is it already added?
TagsNo tags attached.
Fixed in build



2021-03-05 06:47

updater   ~0062255

By the way, this line in your vbs2js converter is useless:
arrVBStoJS.push(new Array('[\\s]*(Server.)*CreateObject\\("', ' new ActiveXObject("'));

ActiveXObject is supported only in JScript, not JavaScript.


2021-03-07 17:53

developer   ~0062280

Good question. I'm doubtful that it is currently possible, since the COM model is Windows-only (and the goal is to make MM5 cross platform), but there might be a way to access it via js. Petr will be able to answer.

And thank you for mentioning that about the ActiveXObject; I think the VBStoJS project still needs quite a bit of work, so I'm noting that for when we get back to work on it.


2021-03-09 23:52

updater   ~0062329

Could this be possible if you somehow integrate Node.js (Electron, NW.js) + node-activex into the program?


2021-03-10 15:55

developer   ~0062349

Last edited: 2021-03-10 15:55

View 2 revisions

I would guess that MM5 is too far in its development to introduce a new framework - after all, it's very close to its initial release. If they (Jiri and Petr?) decide to add COM access via JS, it would make more sense to do it via a native method in the "app" object. My guess as to why it's not done is because they spent a lot of work to make sure all the functionality can be achieved through JS methods (to enable cross-platform).

There can also be ways around it, though, if you have an external program that accesses MM5's COM. There's a new method, runJSCode, which can let you invoke methods from within MM5. So you could have a "normal" (JS) addon that introduces additional methods to the global window object, and you can invoke them with runJSCode.

For example, you can define a function window.runJSCode_callback in an addon, and then you can invoke it with:
SDB.runJSCode("(()=>{runJSCode_callback('This was sent by a VB Script!')})();", True)


2021-03-10 17:37

developer   ~0062353

I'm pretty sure we will not integrate Node.js or similar 3rd party framework.


2021-03-11 07:33

updater   ~0062376

I don't need any 3rd party framework. I just need what I asked for in the Summary: to use COM objects in JavaScript from inside MM. Which is not the same as using MM5 through its COM from an external application and cannot be substituted with that.


2021-03-11 10:58

developer   ~0062377

I've assigned to Jiri for a feedback, but i think we will not add any additional COM support.


2021-03-11 12:07

administrator   ~0062378

Zvezdan, to clarify, I suppose that you don't need to access native MM functionality over COM, but rather some third-party COM objects, right?


2021-03-11 18:09

updater   ~0062388

Yes and no, I would like to have both. I want to access native MM functionality over COM from external application, and I want to access the third-party COM objects in JavaScript of my add-ons within MM. You have already implemented the first part, but I need the second part as well.


2021-03-12 02:43

updater   ~0062404

If it is still unclear, here is an example that is possible in JScript and JavaScript with node-activex, but not with plain JavaScript:
var xl = new ActiveXObject("Excel.Application");

which is an equivalent to this VBScript:
Set xl = CreateObject("Excel.Application")


2021-03-16 11:14

administrator   ~0062465

We looked into it with Petr and generally speaking it is possible to implement ActiveX support. We'll see whether we could get it into MM5.1. That said, plain JS implementations would be preferred. I wonder whether there are cases where ActiveX support is critically needed? In the mentioned case of Excel, there's quite a lot of free JS implementations that should be able to replace Excel at least for basic work (, or, the exact choice would probably depend on the exact needs).


2021-03-16 20:25

updater   ~0062467

Thanks for the links. I mentioned Excel just as a popular example, which is (was) used even in your own Export.vbs script. I think that I read in Forum long time ago that someone was using Excel from MM in that way as well. Keep in mind that there are users writing MM scripts for their own personal use, which are not published anywhere. I estimate that the number of such scripts is the same or even more than the published ones.

I am sure that many Windows users have a need for different COM objects in their scripts that cannot be found in any free JavaScript implementations.