Page 1 of 1

How to read text file through Dropbox

Posted: Fri Aug 16, 2013 1:41 pm
by Opaquer
Hey everyone

I made a post in the beginners section, but haven't had much luck with it yet :(. Basically, I want to have a text file in Dropbox/Drive of various events that are happening throughout the month. When an event happens or is updated etc, all I have to do is edit the Dropbox/Drive file, and it'll update. That bit is easy :P

The issue I'm having is somehow making Livecode read the text file. The best I can do is getting a bunch of html code for the Dropbox/Drive link, but I can't get the actual text into it :(. I've used this code:

put url "dropboxtextlink" into eventlist
put eventlist into field "events"

That code gives me the massive amount of html code. I've tried looking online, and came across htmltext, so added this code afterwards:

set the htmlText of field "events" to "dropboxtextlink"

I think I'm doing something wrong, because it still doesn't work :P.

I'm able to upload the file manually to my site and use that link, or have the file from my HDD. The only issue with uploading it to my site is I'd have to do a bit of playing around to add a new file etc, and if it's on my HDD and I'm not near it, I can't change it, which is why I'd much prefer having a file on dropbox etc.

Any suggestions/tips etc etc would be appreciated :). Loving Livecode so far, but coming from a VB background (in which I never touched any web stuff), it's a little bit of a challenge :P

Re: How to read text file through Dropbox

Posted: Fri Aug 16, 2013 2:01 pm
by LCNeil
Dear Opaqure,

Thank you for your request.

Try replacing www in your dropbox share link to dl and remove the s in https e.g.

https://www.dropboxusercontent.com/s/p0 ... r/test.txt"

would become

http://dl.dropboxusercontent.com/s/p0qv ... r/test.txt"

This is one method that should allow you to view the text document stored on your dropbox account in LiveCode.

Please feel free to use my supplied link as an example

Kind Regards,

Neil Roger
-----
RunRev Support Team ~ http://www.runrev.com
------

Re: How to read text file through Dropbox

Posted: Fri Aug 16, 2013 2:17 pm
by Opaquer
Thank you so much! Just a simple fix like that, and suddenly it works perfectly :D!

Re: How to read text file through Dropbox

Posted: Fri Aug 23, 2013 8:24 am
by alon
thanks you have also solved my problem by your answer...:)

Re: How to read text file through Dropbox

Posted: Thu Sep 05, 2013 11:13 pm
by seaniepie
Hi Neil,
Thanks, that fixed my issue too. A question that arrises from this though. If we are dropping the 's' from the https does that mean that our connection is no longer secure? What are the implications of this method?

Thanks again
Sean Cole
Pi Digital

Re: How to read text file through Dropbox

Posted: Fri Sep 06, 2013 12:26 am
by Opaquer
I didn't drop the s when I was doing it. I just changed the www to dl and it works for me :)

Re: How to read text file through Dropbox

Posted: Wed Jun 13, 2018 9:02 pm
by Der-Schredder
I know this thread is old, but I give it a try.
This trick works for me, but only in the Livecode environment. It does not work on Windows and Android standalone. Did anyone experience similar behaviour?
I created a simple Stack to test it: A field containing the link, a field that gets the content of the file and a button that updates it. The button has this Skript:

Code: Select all

on mouseUp
   put field "Link" into dropboxLink
   put url(dropboxLink) into fileContent
   put fileContent into field "Content"
end mouseUp
The link I am testing is (without the blanks): http://dl.dropbox. com/s/lnait7te51is82w/FileForDropboxTest.txt?dl=0
The content of it is: "This is the content of the Dropbox file."

Best regards,
Leo

Re: How to read text file through Dropbox

Posted: Wed Jun 13, 2018 9:13 pm
by Klaus
Hi Leo,

it works with httpS!

Code: Select all

...
put url("https://dl.dropboxusercontent.com/s/lnait7te51is82w/FileForDropboxTest.txt?dl=0") into fld 1
...
Best

Klaus

Re: How to read text file through Dropbox

Posted: Thu Jun 14, 2018 8:39 am
by Der-Schredder
Thanks a lot. It seems like I had two problems. First one was the missing "s", second one was the round brackets next to the url command.

This only works inside livecode:

Code: Select all

   put field "Link" into dropboxLink
   put url(dropboxLink) into fileContent
This works everywhere.

Code: Select all

   put field "Link" into dropboxLink
   put url dropboxLink  into fileContent
I guess I have to take a look into brackets in livecode. :|
That was a frustrating (and time consuming) problem...

Re: How to read text file through Dropbox

Posted: Thu Jun 14, 2018 2:08 pm
by Klaus
Hi Leo,

it was the missing S, using brackets, although not neccessary here, also works!


Best

Klaus

Re: How to read text file through Dropbox

Posted: Fri Jun 15, 2018 9:25 am
by Der-Schredder
I think I found the gremlin everyone is talking about. :twisted: It defenitely did not work with the brackets and httpS.

Re: How to read text file through Dropbox

Posted: Fri Jun 15, 2018 10:00 am
by Klaus
Really? :shock:

I tested this on my Mac and it worked as exspected with S AND brackets:

Code: Select all

...
## I put the HTTPS url into this field:
put field "Link" into dropboxLink
put url(dropboxLink) into fld 2
...
What platform are you on?

Re: How to read text file through Dropbox

Posted: Sat Jun 16, 2018 8:29 am
by Der-Schredder
I'm on Windows 10. It did not work in the Windows Standalone and Android Standalone.

Re: How to read text file through Dropbox

Posted: Sun Jun 17, 2018 7:34 pm
by sphere
Hallo leute,

i never use the brackets with this, i do this:

Code: Select all

put URL "https://verynicewebsite.com" into tT
put tT in Field"dowhatyouwantwiththedata"
or

Code: Select all

put "https://verynicewebsite.com" into tLink
put URL tLink into tT
put tT in Field"dowhatyouwantwiththedata"
By the way, it should not matter on which either platform you are.

Ciao!
Sphere