I recently had the chance to revisit some Groovy code written last year which makes use of the Scriptom library, a Groovy/COM bridge which allows you to script ActiveX and COM components from Groovy. The code in question was fairly fragile in the worst of ways: it would crash roughly half the time… randomly.
Now, I’m not sure if the crashes were caused by Scriptom or by Jacob, the underlying Java/COM bridge, but after upgrading to the latest version of Scriptom (1.5.4b11, which also uses a newer version of Jacob) all of these crashes have disappeared.
The migration process took a couple of hours, but only because I didn’t read the Migrating from Previous Versions of Scriptom section on this page first; if I had done so, the migration would have been a matter of minutes.
Anyway, kudos to the Scriptom team (which apparently includes Marc Guillemot, a fellow HtmlUnit hacker) on an excellent release of this very useful library!
Marc Guillemot said,
September 18, 2008 at 5:46 am
I fear that I don’t merit any kudos here
I’ve made some contributions to the project for some (long) time, but that’s all (at the time where it crashed randomly what motivated to migrate to POI to read my Excel files
).
Jason Smith said,
March 27, 2009 at 11:14 pm
Thanks! Most of the crashes that you were experiencing were probably fixed because of the addition of Scriptom.inApartment(), which manages the Microsoft apartment model a bit better.
Excel automation is notorious for being difficult to get right. There is a class called ExcelHelper which – well – helps with automating Excel. There are examples included with Scriptom that show how to use it, and the source code is not long. It takes care of setting a few flags and works from a copy of the original file, all of which make the automation process a lot more robust.
Jacob is a great library, but you have to know a lot about COM to get it to work reliably. We’ve been working to hide all the best tricks in Scriptom so that it’s easier for COM experts and novices alike.
I’m glad you like the improvements!