Lisp HUG Maillist Archive

invoke-dispatch-method exception

Hello,
following snippet being loaded to freshly started LispWorks 6.1 Professional causes exception which from my current understanding is not what expected. My OS is Windows 7 x64.
I hope to get something meaningful from the last line of script. I want object corresponding to DOM element at best :-)
(please, ignore TRUE/FALSE errors for the moment)
Any help will be appreciated!

(in-package "CL-USER")
(require "com")
(require "embed")
(COM:CO-INITIALIZE)
(setq pane (make-instance 'capi:ole-control-pane :component-name "Shell.Explorer" :visible-border t))
(capi:contain pane)
(setq disp (capi:ole-control-i-dispatch pane))
(com:invoke-dispatch-method disp "Navigate" "http://www.google.com")
(com:use-type-library "c:/Windows/System32/mshtml.tlb")
(setq doc (com:invoke-dispatch-get-property disp "Document"))
(setq html3 (com:query-interface doc 'I-H-T-M-L-DOCUMENT-3))
(com:invoke-dispatch-method html3 "getElementById" "gbqfq")


--
Yakov Zaytsev
+7 921 343 4327 (Russia)

Re: invoke-dispatch-method exception

ok ok now I feel so.. well, I've done my homework now.
For future references following fixes the problem

(in-package "CL-USER")
(require "com")
(require "embed")
(COM:CO-INITIALIZE)
(com:use-type-library "c:/Windows/System32/mshtml.tlb")

(setq pane (make-instance 'capi:ole-control-pane :component-name "Shell.Explorer" :visible-border t))
(capi:contain pane)
(defun dom? ()
 (capi:apply-in-pane-process
  pane
  #'(lambda ()
      (let ((disp (capi:ole-control-i-dispatch pane)))
        (com:invoke-dispatch-method disp "Navigate" "http://ya.ru")
        
        (let* ((doc (com:invoke-dispatch-get-property disp "Document"))
               (html3 (com:query-interface doc 'I-H-T-M-L-DOCUMENT-3)))
          
          (let ((elem (com:invoke-dispatch-method html3 "getElementById" "text")))
            (capi:display-message
             (with-output-to-string (*standard-output*)
               (format t "~A" (com:invoke-dispatch-get-property elem "tagName")))))
          ))
      )))


On Wed, Oct 10, 2012 at 5:26 PM, Yakov Zaytsev <yakov@clickgrab.net> wrote:
Hello,
following snippet being loaded to freshly started LispWorks 6.1 Professional causes exception which from my current understanding is not what expected. My OS is Windows 7 x64.
I hope to get something meaningful from the last line of script. I want object corresponding to DOM element at best :-)
(please, ignore TRUE/FALSE errors for the moment)
Any help will be appreciated!

(in-package "CL-USER")
(require "com")
(require "embed")
(COM:CO-INITIALIZE)
(setq pane (make-instance 'capi:ole-control-pane :component-name "Shell.Explorer" :visible-border t))
(capi:contain pane)
(setq disp (capi:ole-control-i-dispatch pane))
(com:invoke-dispatch-method disp "Navigate" "http://www.google.com")
(com:use-type-library "c:/Windows/System32/mshtml.tlb")
(setq doc (com:invoke-dispatch-get-property disp "Document"))
(setq html3 (com:query-interface doc 'I-H-T-M-L-DOCUMENT-3))
(com:invoke-dispatch-method html3 "getElementById" "gbqfq")


--
Yakov Zaytsev
+7 921 343 4327 (Russia)



--
Yakov Zaytsev
+7 921 343 4327 (Russia)
Updated at: 2020-12-10 08:36 UTC