Reading the instructions of IEC.py[*] (which perhaps I'd port to Ruby) I see they suggest to run something to be able to use early binding. Is there something analogous for Ruby? I browser the docs of WIN32OLE that offer some methods, but the usage in IEC.py is transparent to this.
-- fxn
[*] http://www.mayukhbose.com/python/IEC/index.php
Tuning Performance
An issue with using COM objects in Python, is the matter of Late Binding vs. Early Binding. Basically, there are two ways that a Python COM object can access its methods and properties. These two methods are called Late Binding and Early Binding. If a Python COM object uses Late Binding, then every time you access a method or property of the object, it goes through the IDispatch interface to find the method/property, even if it is the same one being called each time. With Early Binding, we let Python know ahead of time, what methods and properties are available to an object. This speeds up things significantly, especially inside loops, and the performance gains are actually quite substantial. To enable Early Binding for the Internet Explorer object, we need to import the Internet Explorer library. To do this:
* In PythonWin, go to Tools --> COM Makepy Utility
* In the dialog box that pops up, scroll down till you reach Microsoft Internet Controls. If there are multiple versions, simply pick the latest one.
* Click on the OK button. The PythonWin environment will freeze for a little bit, while the library is being imported. In a little while, you should see a message on the Interactive Window that says that a file was generated.
* You've successfully generated a Python type library for Internet Explorer. From now on, Python will automatically use the type library to early-bind any Internet Explorer objects.
You can get by without importing the Internet Explorer library, but the performance gains are well worth it.