What's the correct tsnetget syntax

JJS jjs at krutt.org
Wed Apr 10 14:02:03 EDT 2019


ok

1. don't just copy paste---> the copy of the website of techstrategies 
gives an error due to the strange double quote they use

“File has been downloaded” instead of  "helpdownloaded" <-- do you see 
the differnece in the quotes? i hope it stays seeable in this list

I just saw it when i was retyping the line of text to find out where the 
erro unquoted literal came from, cause i could not see any difference.

2. Still i'm curious about  libURLDownloadToFile if it does not work 
good due to tsnet (if that is why it is not working good)


have to test some more



Op 10-4-2019 om 20:39 schreef JJS via use-livecode:
> Hi,
>
>
> i used to use :
>
> put specialFolderPath("home") & "/help.pdf" into tHier
>   libURLDownloadToFile 
> "https://awebsite.com/afolder/help.pdf",tHier,"helpdownloaded"
>
>    and then this
>
>    on helpdownloaded
>    put specialFolderPath("home") & "/help.pdf" into tFile
>    if there is a file tFile then
>       launch document tFile
>    end if
> end helpdownloaded
>
>    so it would be opened in the standard pdf reader or in the browser 
> widget
>    now it worked good since lately
>
>    But does tsnet and libURLdownLoadtofile bite each other?
>    because i use tsnet for some smtp email funtions
>
>    and it seems but i'm not sure that since then it won't download 
> except when i put this on the next line:
>    answer the result
>
>    is that not weird?
>
>    next i tried tsnetget, but it fails probably due to a fault of me:
>    put tsNetGetFile("3", tHier, 
> "https://awesomewebsite.com//fantasticfolder/help.pdf", 
> "transferComplete") into tResult
>    tsNetCloseConn "3"
>
>     and then
>
>     on transferComplete pID, pResult, pBytes, pCurlCode
>       local tData,tError
>    if pCurlCode is 0 and pResult is 200 then
>       -- If successful, retrieve the downloaded data
>       put tsNetRetrData(pID, tError) into tData
>       helpdownloaded
>    end if
> end transferComplete
>
> Nothing is happening and if i try the example from the webpage of 
> techstrategies who wrote tsnet it's starts complaining that the 
> parameters are not good.
>
>
> Example 1:
>
>    local tHeaders, tResult
>    put tsNetGetFile(“1”, “/path/to/downloaded/file.dat”, \
>       “ftp://user:pass@ftp.example.com/file.dat”, tHeaders, \
>       “transferComplete”) into tResult
>
> Example 2:
>
>    on transferComplete pID, pResult, pBytes, pCurlCode
>       local tData, tHeaders
>       if pCurlCode is not 0 then
>          answer tsNetRetrError(pID)
>       else
>          answer “File has been downloaded”
>       end if
>       tsNetCloseConn pID
>    end transferComplete
>
>    anyone a working example of how it should work?
>    and maybe an explanation why the liburl command does not work 
> anymore(correct)  (on lc904rc2)
>
>    thanks a lot for any help!
>    Sphere
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the Use-livecode mailing list