0 Members and 1 Guest are viewing this topic.
(setq shell (vlax-create-object "Shell.Application"))(vlax-invoke shell 'open "http://carnet-de-cablage.chez-alice.fr/Lisp/Rbloc.zip")(vlax-release-object shell)
(setq ie (vlax-Create-Object "InternetExplorer.Application"))(vlax-invoke ie 'navigate "http://carnet-de-cablage.chez-alice.fr/Lisp/Rbloc.zip")(vlax-release-object ie)
'Create local file and save results to it vFF = FreeFile If Dir(vLocalFile) <> "" Then Kill vLocalFile Open vLocalFile For Binary As #vFF Put #vFF, , oResp Close #vFF
(defun mst-activate (/ key) (setq key (MST-GetFileFromURL "http://www.theswamp.org/lilly.pond/public/key.txt" ) ) (if key (alert (strcat "Thank you for being my beta tester\n Make note of this number -> " key ) ) ) (princ) )(defun MST-GetFileFromURL (strURL / fo key vlUtilObj RemoteFile TmpFile) (setq vlUtilObj (vla-get-Utility (vla-get-ActiveDocument (vlax-get-acad-object)) ) ) (if (and (= (type strURL) 'STR) (= (vla-IsURL vlUtilObj strURL) :vlax-true) ) (setq RemoteFile (vl-catch-all-apply 'vlax-invoke-method (list vlUtilObj 'GetRemoteFile strURL 'TmpFile :vlax-false) ) ) ) ; if (if (not (vl-catch-all-error-p RemoteFile)) (if (setq fo (open TmpFile "r")) (if (setq key (read-line fo)) (close fo) ) ) ) (if (vl-file-delete TmpFile) key ) )(mst-activate)
For the pleasure, and in spite of the great solution of Mark, I continued with the ElpanovEvgeniy proposal but a problem arises. How to write in a file the character Null (chr 0) ?Thanks in advance@+
(setq f(open "d:\\test.txt" "w"))(repeat 100 (WRITE-LINE (VL-LIST->STRING '(0 0 0 0 0 0 0 0)) f) )(close f)
(defun download (url dir / byte fic file http tbl) (setq http (vlax-create-object "MSXML2.XMLHTTP")) (vlax-invoke-method http 'open "get" url :vlax-false) (vlax-invoke http 'send) (while (not (eq (vlax-get http 'readyState) 4)) (repeat 100) ) (setq file (strcat dir (vl-filename-base url) (vl-filename-extension url)) tbl (vlax-safearray->list (vlax-variant-value (vlax-get-property http 'responsebody))) fic (open file "w") n 0) (foreach byte tbl (if (eq byte 0) (princ (vl-list->string '(0)) fic) (write-char byte fic) ) ) (close fic) (vlax-release-object http) (princ))
(download "http://carnet-de-cablage.chez-alice.fr/Lisp/Latt.zip" "c:/")
Thank you Evgeniy I'm there almost what I don't understand, this is why when I open the zip and that I look at the files, those are empty Code: [Select](defun download (url dir / byte fic file http tbl) (setq http (vlax-create-object "MSXML2.XMLHTTP")) (vlax-invoke-method http 'open "get" url :vlax-false) (vlax-invoke http 'send) (while (not (eq (vlax-get http 'readyState) 4)) (repeat 100) ) (setq file (strcat dir (vl-filename-base url) (vl-filename-extension url)) tbl (vlax-safearray->list (vlax-variant-value (vlax-get-property http 'responsebody))) fic (open file "w") n 0) (foreach byte tbl (if (eq byte 0) (princ (vl-list->string '(0)) fic) (write-char byte fic) ) ) (close fic) (vlax-release-object http) (princ))Code: [Select](download "http://carnet-de-cablage.chez-alice.fr/Lisp/Latt.zip" "c:/")@+
(while (not (eq (vlax-get http 'readyState) 4)) (repeat 100) )
(while (not (eq (vlax-get http 'readyState) 4)) (if acet-sys-sleep (acet-sys-sleep 5);;(acet-sys-sleep [time-pause-msec]) (repeat 100) ) )
Quote from: Patrick_35 on February 26, 2007, 08:10:20 AMThank you Evgeniy I'm there almost what I don't understand, this is why when I open the zip and that I look at the files, those are empty Code: [Select](defun download (url dir / byte fic file http tbl) (setq http (vlax-create-object "MSXML2.XMLHTTP")) (vlax-invoke-method http 'open "get" url :vlax-false) (vlax-invoke http 'send) (while (not (eq (vlax-get http 'readyState) 4)) (repeat 100) ) (setq file (strcat dir (vl-filename-base url) (vl-filename-extension url)) tbl (vlax-safearray->list (vlax-variant-value (vlax-get-property http 'responsebody))) fic (open file "w") n 0) (foreach byte tbl (if (eq byte 0) (princ (vl-list->string '(0)) fic) (write-char byte fic) ) ) (close fic) (vlax-release-object http) (princ))Code: [Select](download "http://carnet-de-cablage.chez-alice.fr/Lisp/Latt.zip" "c:/")@+Hello Patrick.On my computer, this code works!
but the code works in my computer toBut if you launch the zip and extract the files, they're empty @+
Thanks EvgeniyI don't understand. It's a windows version ? . I work with Xp Professional.@+