KB-59914: Calling a.NET DLL assembly from VBScript.

Question:

Can a.NET DLL assembly be called from VBScript? Can different methods from the DLL be called, and different parameters be sent directly via E3 scripts?

Solution:

Yes, this is possible. To do so, follow these procedures:

1) Create a.NET assembly (collection of files that appear as a single DLL for the programmers) according to the item 2 in the article Creating .NET assemblies and instancing them by using the VBScript Driver.

2) Once the class library’s project has been created, you will need to register it in the system. This can be accomplished in one of the following ways:
a) With an Assembly Registration Tool (Regasm.exe): “regasm  /codebase C:\TestAssembly.dll”  or


Figure 1

b) By accessing the project’s properties directly at Visual Studio, via Register for COM interop option:


Figure 2

3) When the DLL is ready and registered for the access, insert the script that will call the newly developed assembly’s ShowMessage method:


Figure 3

If these procedures were executed correctly, the message box with “Hello World!” will be displayed when the script is executed.


Figura 4
Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

Leave a Reply

Your email address will not be published.Required fields are marked *