Code written with Scriptom looks great and is easy to read. Sure. But it may not be as easy to write as it is to read.  Where is the look-ahead help? Where is the integration with your favorite IDE? How do you get started writing code against COM objects, many of which have little or no online documentation?  In this rather short article, I talk about why Scriptom does not have IDE integration, along with some techniques and tools you can use to make COM programming with Scriptom much easier.

No IDE Integration for Scriptom

Let's start with IDE integration.  To make it short, there isn't any, and it isn't planned.  The trouble is, Scriptom uses "late bound" COM calls, exclusively.  Every COM object in Scriptom is just an ActiveXObject to Groovy.  Even at runtime, there is no reliable way to determine exactly what kind of an object you are working with under the covers.  Scriptom just passes the method name, along with the arguments, to Windows - and trusts that everything will go well. 

For those of us who are used to static typing, this may seem like a dangerous practice.  I think you will find, though, that it works surprisingly well.  It also simplifies things considerably.  Have you seen the number of COM wrappers that Microsoft.NET has to support (for some, multiple versions of the same library)?  Scriptom doesn't require a COM wrapper generator (though it does include constant definitions for some COM libraries).  You can just write your code and run it.  And it just works.

Scriptom uses the same calling mechanism that is used by Microsoft's typeless scripting languages, like VBScript and JScript.  It is also the calling convention that is used from Visual Basic 6 or VBA when you are working with an Object.  That is why they call it Scriptom.  It uses the calling convention that is normally used by scripting languages.

An Easier Way than Trial and Error

So if there is no IDE integration for Scriptom, how do you figure out the COM thing?  Here are some ideas, based on my own experience working with COM.  These aren't quite the same as having full IDE integration, like Java in Eclipse, but in my experience they do help you get the job done.

There.  That should get you started off on the right foot.  Enjoy!    


 

This article was consolidated from ideas developed in an email thread in the Groovy users list.  Thanks to Thomas Elmiger and A. Tres Finocchiaro.