CAD/CAM discussion forum > CAD > 'responsebody don't work in zw2017?

'responsebody don't work in zw2017?

  Subscribe Topic

Rank: 1



posts: 1

Registered: 2014-12-29

Message 1 of 2

 'responsebody don't work in zw2017?
26-04-2017 02:26 . pm   |   View his/her posts only
This code run in acad but don't work in zw17
(defun download (url / )
(setq httpinit (vlax-create-object "MSXML2.XMLHTTP")
fso (vlax-create-object "Scripting.FileSystemObject")

(vlax-invoke-method httpinit 'open "get" url :vlax-false)

(if (vl-catch-all-error-p (vl-catch-all-apply 'vlax-invoke (list httpinit 'send)))
(princ (strcat "\nLe lien " url " n'est pas valide."))
(if (eq (vlax-get httpinit 'status) 200)
(if (vl-catch-all-error-p (setq taille (vl-catch-all-apply 'vlax-invoke (list httpinit 'getResponseHeader "Content-Length"))))
(princ "\nErreur de lecture sur la taille du fichier.")
(princ "\nDownload...\n")(princ)
(while (not (eq (vlax-get httpinit 'readystate) 4))
(vla-eval (vlax-get-acad-object) "DoEvents")

(setq tbl (vlax-safearray->list (vlax-variant-value (vlax-get-property httpinit 'responsebody))))

(setq rezultat nil)
(foreach byte tbl
(setq rezultat (append rezultat (list byte)))

(princ (vl-list->string rezultat))


(princ (strcat "\n" (vlax-get httpinit 'statustext) "...Erreur " (itoa (vlax-get httpinit 'status)) "."))
(vlax-release-object httpinit)

(download "")

I see that it returns variable tbl nil nil nil etc.
Thank you!

Rank: 5Rank: 5


posts: 528

Registered: 2015-6-9

Message 2 of 2

27-05-2017 09:49 . am   |   View his/her posts only
Reply 1# toderut3226

Hi, I tried this code in AutoCAD as well, but got an error ; error: bad char code in list: -8398.
What is the correct result if this code is workable? Thanks
See also