How to read text file through Dropbox

Bringing the internet highway into your project? Building FTP, HTTP, email, chat or other client solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Opaquer
Posts: 247
Joined: Wed Aug 14, 2013 8:24 am

How to read text file through Dropbox

Post 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
LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: How to read text file through Dropbox

Post 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
------
Opaquer
Posts: 247
Joined: Wed Aug 14, 2013 8:24 am

Re: How to read text file through Dropbox

Post by Opaquer »

Thank you so much! Just a simple fix like that, and suddenly it works perfectly :D!
alon
Posts: 1
Joined: Fri Aug 23, 2013 8:18 am

Re: How to read text file through Dropbox

Post by alon »

thanks you have also solved my problem by your answer...:)
seaniepie
Posts: 154
Joined: Wed Sep 07, 2011 10:56 am

Re: How to read text file through Dropbox

Post 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
Opaquer
Posts: 247
Joined: Wed Aug 14, 2013 8:24 am

Re: How to read text file through Dropbox

Post 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 :)
Der-Schredder
Posts: 6
Joined: Mon Jun 11, 2018 12:20 pm

Re: How to read text file through Dropbox

Post 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
Klaus
Posts: 14325
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How to read text file through Dropbox

Post 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
Der-Schredder
Posts: 6
Joined: Mon Jun 11, 2018 12:20 pm

Re: How to read text file through Dropbox

Post 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...
Klaus
Posts: 14325
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How to read text file through Dropbox

Post by Klaus »

Hi Leo,

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


Best

Klaus
Der-Schredder
Posts: 6
Joined: Mon Jun 11, 2018 12:20 pm

Re: How to read text file through Dropbox

Post by Der-Schredder »

I think I found the gremlin everyone is talking about. :twisted: It defenitely did not work with the brackets and httpS.
Klaus
Posts: 14325
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How to read text file through Dropbox

Post 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?
Der-Schredder
Posts: 6
Joined: Mon Jun 11, 2018 12:20 pm

Re: How to read text file through Dropbox

Post by Der-Schredder »

I'm on Windows 10. It did not work in the Windows Standalone and Android Standalone.
sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am

Re: How to read text file through Dropbox

Post 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
Post Reply