Script Tips

A Whole Lotta Intellisense

Code hints and code completion are welcome features for the scripter, so how can you make sure those features pop up when needed?

A lot of scripters use commercial script editors that provide IntelliSense-like code hinting and code completion features (note that IntelliSense is a Microsoft brand name for these features). These features provide, among other things, pop-up menus for COM objects, helping you discover and remember the objects' methods, properties, and so forth.

Problem is, a lot of objects — most notably the COM objects that expose Microsoft Office automation — don't seem to support these pop-up menus. Why not? Well, when an object's DLL is installed and registered, a second file should also be installed and registered. This file is called a type library, which often has a TLB filename extension (although sometimes its OLB), and it's what contains the lists used by the IntelliSense-like features.

Sometimes, objects really do have a type library file — it's just not registered. For example, poke around in your Microsoft Office installation folder and you'll find an OLB file for each of the major applications: Msacc.olb for Access, Msword.olb for Word, and the inexplicably named xl5en32.lb for Excel. Guess the Excel guys didn't get the naming memo.

Anyway, some editors require you to simply tell them that the file exists and where it's located. Usually, you'll provide the ProgID of the COM object, and then the corresponding type library. You can also register the type library, much in the same way you'd register the COM object DLL.

However, good old Regsvr32.exe can't register a type library; you'll need to find an external utility capable of doing so. It usually isn't necessary, though, since the only thing that'd use the type library is a development environment or script editor, and, as I've pointed out, most will allow you to manually specify the type library if necessary.

About the Author

Don Jones is a multiple-year recipient of Microsoft’s MVP Award, and is Curriculum Director for IT Pro Content for video training company Pluralsight. Don is also a co-founder and President of PowerShell.org, a community dedicated to Microsoft’s Windows PowerShell technology. Don has more than two decades of experience in the IT industry, and specializes in the Microsoft business technology platform. He’s the author of more than 50 technology books, an accomplished IT journalist, and a sought-after speaker and instructor at conferences worldwide. Reach Don on Twitter at @concentratedDon, or on Facebook at Facebook.com/ConcentratedDon.

comments powered by Disqus
Most   Popular