libUrlDownloadToFile: desktop ok, Android no

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

libUrlDownloadToFile: desktop ok, Android no

Matthias Rebbe via use-livecode
Hello.

Below is the script used to download a text file. Which works on the
Windows desktop. But on my Nexus 5, "error" is returned by the  script
commands "log" and "logflushbuffer".

Why oh why ...

Help! please.

---------------------------

BUTTON SCRIPT

on mouseUp
   put empty into the last field
   libUrlDownloadToFile binURL(), specialFolderPath("documents") \
         & slash & "dictionary.txt", "urlDownloadStatus"
   log "started download of" && binURL()
end mouseUp

on urlDownloadStatus pUrl, pStatus
   log pStatus && pUrl
end urlDownloadStatus


CARD SCRIPT

local sLogBuffer
local sLogBuffering="false"

on log pMsg
   put pMsg & return after sLogBuffer
   if not sLogBuffering then logFlushBuffer
end log

on logFlushBuffer
   put sLogBuffer after field "logField"
   put empty into sLogBuffer
   set the vscroll of field "logfield" to 65536
end logFlushBuffer

on clearLog
   put empty into field "logField"
   put empty into sLogBuffer
end clearLog

on logStartBuffer
   put true into sLogBuffering
end logStartBuffer

on logEndBuffer
   logFlushBuffer
   put false into sLogBuffering
end logEndBuffer

--------

on preOpenCard
   if the environment is not "mobile" then
      libUrlSetStatusCallback "urlProgressCallback", the long ID of me
   end if
   pass preOpenCard
end preOpenCard

on closeCard
   if the environment is not "mobile" then
      libUrlSetStatusCallback
   end if
end closeCard

on urlProgressCallback pStatus, pURL
   urlProgress (item 1 of pStatus), pURL, (item 2 of pStatus), (item 3 of
pStatus)
end urlProgressCallback

on urlProgress pURL, pStatus, pRecieved, pTotal
   if pStatus is "loading" then
      logStartBuffer
   else
      logEndBuffer
   end if
   log pStatus && pURL && pRecieved && pTotal
end urlProgress

local sURL = "http://webserver.com/docs/UTF8_file.txt"

function binURL
   return sURL
end binURL
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: libUrlDownloadToFile: desktop ok, Android no

Matthias Rebbe via use-livecode
On 1/11/18 10:37 PM, Nicolas Cueto via use-livecode wrote:
> Below is the script used to download a text file. Which works on the
> Windows desktop. But on my Nexus 5, "error" is returned by the  script
> commands "log" and "logflushbuffer".

The most likely reason is that the field needs a complete reference, the
defaultstack may have changed.

put sLogBuffer after field "logField" of card x of stack y

--
Jacqueline Landman Gay         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode