Lisp HUG Maillist Archive

Nested COM objects

Greetings Lisp HUG,

I am very much enjoying my experience thus far with LispWorks but have run into an issue I could use your help with.  Currently I am able to automate another Windows program from LispWorks via COM.  Running methods on objects is no problem except for when the application object has other objects nested within.  For example in VBScript:

ApplicationObject.ThisMethodWorksNoProblem

There is no problem running #'invoke-dispatch-method on ThisMethodWorksNoProblem.

What I cannot do is: ApplicationObject.NestedOperatorsObject.CannotUseThisMethod

Does LispWorks have any way for me to #'invoke-dispatch-method on a nested COM object?  Thank you in advance for your help and time.


Best,
DB

Re: Nested COM objects

2013/11/04 David Bloom:
> What I cannot do is:
> ApplicationObject.NestedOperatorsObject.CannotUseThisMethod
>
> Does LispWorks have any way for me to #'invoke-dispatch-method on a nested
> COM object?  Thank you in advance for your help and time.

This seems to work:

 (require "automation")
; lots of output
=> T
 (com:co-initialize)
=> T
 (let* ((word (com:create-object :progid "Word.Application"))
        (docs (com:invoke-dispatch-get-property word "Documents"))
        (doc (com:invoke-dispatch-method docs "Add")))
   ;; do something with doc
   (com:invoke-dispatch-method word "Quit"))

I don't know it there's any readily available syntax to nest method
calls or property reads in one form.

Best regards,

Paulo Madeira

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html


Updated at: 2020-12-10 08:34 UTC