2010-09-28

How to use your own .NET DLLs in EnScript

My buddy Geoff Black has a good overview of how to create your own .Net DLLs so that you can use them in EnScript. He's also put the code on Github.

A couple of quick notes about COM support in EnScript:
  • stick to passing simple data types (ints, Strings, etc.)
  • APIs with COM events (i.e., callbacks) are not supported (e.g., Outlook's Find method)
  • to the best of my knowledge, an EnScript class cannot implement a COM interface
  • On one of the COM classes, call the static SetHaltException() method that appears in EnScript and pass it false. This will keep COM exceptions from propagating into EnScript; you can use SystemClass::LastError() to handle them instead.
    • Yes, this means you need to call LastError() after anything that could possibly fail
  • And, yes, you need to check every return value for nullity before de-referencing it
In general, I much prefer using command-line utilities from EnScript than writing tightly-integrated COM code.

No comments:

Post a Comment