Archive: COM support


COM support
Hello NSIS experts,

is there any easy way to use COM objects in NSIS?
For example, in VBScript I can create a COM object with
CreateObject function and then call any methods that object defines.

Thanks!


You will have to write a plug-in or use an external application.


Actually, the System plug-in in the latest CVS version supports COM. You can find an example in this thread.


Yes, Kichik is right. Use sheduled tasks creator script as sample. For example instead of CreateObject you should call ole32::CoCreateInstance. To call methods you should find the object interface description (.idl file) (compiled from .idl c-style .h file will be even better, it will contain plain interface virtual methods structure) and use methods indexes to call approriate methods.


Thanks, this is definitely a way, although quite cryptic,
for my taste ;-)
I'll try to go with Execute "wscript <my VBScript file>".


Searching for COM integration I found this old thread.

Although NSIS is a wonderful tool, creating an installer for a server side application is more complicated than it should be.

Because we have to perform many tasks like:
1- set a web site (app pool, web service extension, virtual directory, isapi filter...);
2- set some user rights (creation, groups, permissions,...);
3- set some service settings (service logon, dependencies, schedule tasks, DEP,..);

We ended up using a bunch of .cmd, .vbs and .bat scripts outside NSIS. We have experienced numerous difficulties switching shells. For example:

1- cscript.exe not always found;
2- scrun.dll not always registered (used for CreateObject calls);
3- Escaping of strings (like passwords) cross multiple shells;
4- variable delayed expansions issues;

The above thread points to a sheduleTask.nsi file example. This is really a difficult way to do it. Hard to read, hard to maintain.

I would be really great if NSIS was to evolve with a tighter /easier integration to COM.


Just some feedback about this otherwise great software.
Thierry