Author Topic: Save txt-file on internet, read file from internet  (Read 3677 times)

0 Members and 1 Guest are viewing this topic.

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Save txt-file on internet, read file from internet
« on: November 18, 2013, 03:11:53 AM »
Hello!

Have anybody a tip how I can create a txt-file for reading on Internet, something like this http://www.opendcl.com/version/version.txt. I want save som strings, that all people in my company can read.

Woabow

  • Newt
  • Posts: 56
Re: Save txt-file on internet, read file from internet
« Reply #1 on: November 18, 2013, 04:29:00 AM »
Try this, based on this post:
http://www.theswamp.org/index.php?topic=45220.msg504240#msg504240

Code: [Select]
;; Retrieves a text file from http://www.opendcl.com
;; Based on Password Generator  -  Lee Mac
;; http://www.theswamp.org/index.php?topic=45220.msg504240#msg504240

(defun readwwwtxt ( / obj rtn )
        (if (setq obj (vlax-get-or-create-object "winhttp.winhttprequest.5.1"))
            (progn
                (setq rtn
                    (vl-catch-all-apply
                        (function
                            (lambda ( )
                                (vlax-invoke-method obj 'open "GET"
                                    (strcat
                                        "http://www.opendcl.com/version/version.txt"
                                    )
                                    :vlax-false
                                )
                                (vlax-invoke-method obj 'send)
                                (vlax-get-property  obj 'responsebody)
                            )
                        )
                    )
                )
                (vlax-release-object obj)
                (if (vl-catch-all-error-p rtn)
                    (princ (vl-catch-all-error-message rtn))
                    (princ
                        (vl-list->string
                            (mapcar '(lambda ( x ) (lsh (lsh x 24) -24))
                                (vlax-safearray->list (vlax-variant-value rtn))
                            )
                        )
                    )
                )
            )
        )

    (princ)
)
(vl-load-com) (princ)

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Re: Save txt-file on internet, read file from internet
« Reply #2 on: November 18, 2013, 05:00:13 AM »
Thanks that works perfect with "opendcl-txt-file" but if I want read my dropbox-file (readwwwtxt "https://www.dropbox.com/s/sac7a555twkxle0/131016-1S.txt")

it comes the hole html-code
Code: [Select]
<!DOCTYPE html><html lang="en" xmlns:fb="http://ogp.me/ns/fb#" xml:lang="en" class="" xmlns="http://www.w3.org/1999/xhtml"><head>
            <script type="text/javascript">
                window._document_observe_listeners = [];
                document.observe = function(event, func) {
                    window._document_observe_listeners.push({event: event, func: func});
                };

                window._jquery_ready_handlers = [];
                jQuery = function(handler) {
                    window._jquery_ready_handlers.push(handler);
                };

                function on_script_loaded(func) {
                    (window.LoadedJsSuccessfully && document.loaded) ? func() : document.observe('script:loaded', func);
                }
            </script>
         
.....

Woabow

  • Newt
  • Posts: 56
Re: Save txt-file on internet, read file from internet
« Reply #3 on: November 18, 2013, 05:44:44 AM »
The Dropbox page does not only show the text, but a complete page with HTML formating.

Put the text file in your Public folder and put the "public link" in the lisp, example:

Code: [Select]
"https://dl.dropboxusercontent.com/u/2190289/3dcircle.txt"

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: Save txt-file on internet, read file from internet
« Reply #4 on: November 18, 2013, 05:47:34 AM »
Hello!

Have anybody a tip how I can create a txt-file for reading on Internet, something like this http://www.opendcl.com/version/version.txt. I want save som strings, that all people in my company can read.

why not use the Autodesk 360 store?

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Re: Save txt-file on internet, read file from internet
« Reply #5 on: November 18, 2013, 06:36:59 AM »
I have test it, but I canīt read directly my file. I must first download it.

The test with this url works

_$ (readwwwtxt "http://www.opendcl.com/version/version.txt")
6.0.2.5
_$

I want do my own txt.file and save them on www but there I donīt find a option there I can save my file only for reading. Always I have to download first.

for in this file you find coordinates https://www.dropbox.com/s/sac7a555twkxle0/131016-1S.txt
(readwwwtxt "https://www.dropbox.com/s/sac7a555twkxle0/131016-1S.txt") should give me
Code: [Select]
1001,6399639.0050,140917.0395,14.1900,35
1002,6399639.0427,140917.0612,14.1883,33
1003,6399637.9412,140920.9416,14.2981,33
1004,6399637.7453,140922.4169,14.2106,30
1005,6399636.4977,140925.1814,12.9932,37
1006,6399643.8283,140920.0239,14.2999,21
1007,6399644.9423,140922.3941,14.2907,23
1008,6399646.0801,140924.0623,14.2830,28
1009,6399647.4268,140925.8188,14.0676,62
1010,6399658.3731,140934.0247,12.8735,37
1011,6399660.2911,140929.7799,14.2301,30
1012,6399660.8362,140928.7482,14.4935,33
1013,6399661.8820,140925.2360,14.4253,33
1014,6399662.7536,140923.3580,14.1661,34
1015,6399663.7824,140920.9240,14.3407,33
1016,6399665.5760,140925.0868,14.4027,42
1017,6399676.4439,140925.0100,14.4442,33
1018,6399676.0636,140926.9903,14.3849,34
1019,6399675.7558,140929.1346,14.5302,33
1020,6399674.6807,140933.1402,14.6979,33
1021,6399674.5812,140934.4774,14.6329,30
1022,6399674.1669,140938.0629,13.5475,37
1023,6399687.9067,140942.0012,13.6892,37
1024,6399688.9051,140939.0079,14.6122,30
1025,6399689.2605,140937.4530,14.7784,33
1026,6399690.2661,140933.7134,14.6481,33
1027,6399690.8919,140931.8043,14.3896,34
1028,6399691.5671,140929.1749,14.5694,33
1029,6399705.3710,140932.8291,14.6457,33
1030,6399705.1060,140934.7105,14.2285,34
1031,6399704.4094,140937.3823,14.7591,33
1032,6399703.5584,140941.2014,14.9165,33
1033,6399703.4167,140942.4247,14.6681,30
1034,6399703.0543,140945.3158,13.7486,37
1035,6399701.5285,140933.8234,14.2286,24
1036,6399704.4092,140934.7291,14.2568,62
1037,6399708.8118,140934.3335,14.6512,62
1038,6399709.7948,140937.8926,15.1640,63
1039,6399709.7559,140937.8959,15.1487,63
1040,6399719.4849,140936.3540,14.8049,33
1041,6399719.3641,140938.1597,14.4041,34
1042,6399719.0379,140940.6971,14.9729,33
1043,6399718.4117,140944.4596,15.0808,33
1044,6399718.4342,140944.4669,15.0816,33
1045,6399717.9532,140947.8248,13.7029,37
1046,6399732.2193,140950.4480,14.0333,37
1047,6399732.9822,140947.4080,15.2299,33
1048,6399733.0431,140947.3724,15.2237,33
1049,6399733.5920,140943.5537,15.0932,33
1050,6399733.9187,140941.3102,14.6559,34
1051,6399734.2865,140939.1526,14.9514,33
1052,6399749.0539,140941.4067,15.0798,33
1053,6399748.8937,140943.2010,14.7193,34
1054,6399748.5960,140945.9247,15.1997,33
1055,6399748.1738,140949.7447,15.3530,33
1056,6399747.5850,140952.4295,14.3471,37
1057,6399761.6958,140954.3137,14.5520,37
1058,6399762.0116,140951.8847,15.4454,

....

but it comes message like before
« Last Edit: November 18, 2013, 06:57:29 AM by cadplayer »

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Save txt-file on internet, read file from internet
« Reply #6 on: November 18, 2013, 06:59:45 AM »
Put the text file in your Public folder and put the "public link" in the lisp, example:

Code: [Select]
"https://dl.dropboxusercontent.com/u/2190289/3dcircle.txt"

Woabow

  • Newt
  • Posts: 56
Re: Save txt-file on internet, read file from internet
« Reply #7 on: November 18, 2013, 07:07:00 AM »

Code: [Select]
(readwwwtxt "https://dl.dropboxusercontent.com/u/2190289/131016-1S.txt")

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Re: Save txt-file on internet, read file from internet
« Reply #8 on: November 18, 2013, 07:48:42 AM »
Wow it works
How did you get the link dl.dropboxusercontent.com I did not find a publish button on dropbox?

Woabow

  • Newt
  • Posts: 56
Re: Save txt-file on internet, read file from internet
« Reply #9 on: November 18, 2013, 07:54:02 AM »
Public folder, not publish:

https://www.dropbox.com/help/16/en

Oh, wait, they have removed this...?

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Re: Save txt-file on internet, read file from internet
« Reply #10 on: November 18, 2013, 07:56:36 AM »
Ahhh
I get it, I hade not have a public Folder. That was reason why I did not working https://dl.dropboxusercontent.com/...

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Re: Save txt-file on internet, read file from internet
« Reply #11 on: November 18, 2013, 07:57:09 AM »
Thanks all!