The Best Solution
Although TlbInf32 is a great tool for exploring COM objects, you shouldn't have to write custom code to get constants' values every time you want to use them in a script. For that reason, I wrote Export-Enum.wsf, which lets you find out an object's constants and associated values. All you need to do is provide the object's programmatic identifier (ProgID) or the name of the library in which the object resides.
The code in Export-Enum.wsf is similar to the code in Listing 1, except that it has additional code that helps with error handling, output handling, and shutting down applications. I added output-handling routines so that the constants' values are outputted as VBScript constant declarations (e.g., Const ForAppending = 8). You can immediately use the constant declarations by copying and pasting them into a script. The outputhandling routines also add a header so that you know what object the constant declarations are for. . . .
tnbankers October 15, 2008 (Article Rating: