Using .NET Interops in VBScript
(Page 1 of 4 )
Rumor has it that the .NET Framework is inaccessible from VBScript. It’s true that support for VBScript was never implied or included, and it's also true that VBScript cannot instantiate native .NET Framework classes. But that doesn’t mean that the .NET Framework is off limits for scripters—at least, not all of it.
Have I gotten your attention yet? I thought I saw a few ears perk up out there.
Some of the .NET Interops do provide COM-scriptable interfaces, and probably more than you think! You're not going to find a list of these anywhere; nor will they be marked this way in the MSDN documentation. But with a little bit of trial and error you can discover them for yourself-well, at least the ones that I don't show you first.
I'm not going to list and document each of these interops. Instead, I'm going to take a topical approach and let you see them in action, providing explanations as I go. Keep in mind that this article is just the tip of the iceberg and is only meant to serve as an introduction to the concept of implementing .NET interops in VBScript. There is much more available to you than you will see presented here.
Finally, as you begin to explore these interops you will likely need to visit the MSDN documentation to examine the capabilities of each interop. Although you may find one that can be instantiated in VBScript, it's important to remember that all of its members may not be exposed through a scripting interface. You will likely need to perform some trial and error tests to get it working.
Next: Sorting Arrays in VBScript >>
More Windows Scripting Articles
More By Nilpo