This topic contains 5 replies, has 3 voices, and was last updated by  Jeff Drumm 2 years ago.

LUACom

  • I’ve just started looking at the luacom module but I don’t seem to be able to get it to work – CreateObject returns nil. Here’s a really simple example. Am I missing something here?

    require('luacom')
    -- The main function is the first function called from Iguana.
    function main()
       local s = luacom.CreateObject('Shell.Application')
       print(s)   -- 
    end

    Thanks.

    Hi Gary,

    Funny – I just supplied a couple of channels illustrating the use of LuaCOM to connect up to Microsoft message queue to another customer. I’ve chucked up the two translator instances for that in our wiki:

    http://wiki.interfaceware.com/985.html

    Have a look and see if that helps. It’s important to use the LuaCOM which comes with Iguana – not your own copy.

    Sorry to dredge up this old article, but I’m running into the same problem as Garry. The MSMQ article didn’t provide any enlightenment either.

    I can see that the luacom methods are exposed after I require it, but I can’t seem to do any automation with it. At first I assumed that I didn’t have any applications supporting automation services, but I’ve since installed a copy of Word I had lying around and luacom.CreateObject(“Word.Application”) returns nil.

    Jeff Drumm ◊ VP and COO ◊ HICG, LLC. ◊ http://www.hicgrp.com

    Thought I’d circle around and provide some closure to my experiments with LuaCOM. The tldr; version is that its practicality is somewhat limited for MS Office automation, specifically using Iguana. It does work, but there are setup requirements (minimal) as well as limitations that may be undesirable in using it.

    To enable LuaCOM in Iguana, you’ll first need to set a System environment variable:

    CHM_LUACOM_ENABLE=true

    To use it with any applications that interact with the desktop, you’ll need to run Iguana as a foreground app rather than a service, executing \Path\To\Iguana\Install\Dir\iguana.exe from the command line. This particular requirement is, in my opinion, the most significant challenge; it means that Iguana is no longer manageable as a Windows service.

    Some COM functionality does exist while running Iguana as a service, but it’s not the kind that will be really useful for Office automation. It’s also challenging to debug since it doesn’t cope well with the Iguana editor’s automatic execution of Lua code (again, specifically when Iguana is run as a service).

    If there was a way to get this to work seamlessly, it would be a pretty cool way to build/format/import MS Office document content with Iguana. Maybe someday!

    PS. A shout-out and sincere thanks to Wade Shrewsbury @ iNTERFACEWARE for his assistance in figuring out what I was doing wrong.

    Jeff Drumm ◊ VP and COO ◊ HICG, LLC. ◊ http://www.hicgrp.com

    Hmmm – the running in foreground thing sounds like something to do with the user ID that the Iguana process is running under. Have you tried running it under a different user other than the default system?

    Hi Eliot,

    Yes, I normally modify the service configuration to run Iguana under a standard user account rather than the “Local System” account. This modification also provides access to things like network shares. Wade seemed to think it has something to do with the way i/o redirection is handled by Iguana.

    Jeff Drumm ◊ VP and COO ◊ HICG, LLC. ◊ http://www.hicgrp.com

You must be logged in to reply to this topic.