Pulling data from an external file

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

marielle
Livecode Opensource Backer
Livecode Opensource Backer

Post by marielle » Thu Feb 22, 2007 4:26 pm

quailcreek wrote:this is one I can't understand it not supporting.
Just giving it a shot in case there is some misunderstanding going on. Is it the support for ini file read and write that you are surprised not to see supported or file read and write?

To read a file:

Code: Select all

put URL ("file:" & tFilePath) into tFileContent
To write a file:

Code: Select all

put tFileContent into URL ("file:" & tFilePath)
(both assumes that tFilePath contains the path to a file that actually exist on your disk. You can test for it using "if there is a file tFilePath").

Granted, the syntax is a bit "unusual".

Given that you mention that there are various features that interest you in RR, do you want to be stopped from using it simply because reading/writing ini files is something that is not readily available? It is no way impossible to produce, on the contrary. Mark kindly offered a draft of a solution for free but it wouldn't be difficult to get somebody write a solid function you would be able to reuse in various contexts, in exchange of a few bucks or in exchange of another service like beta testing for them.

Please do let us know if we are the ones not to understand your expectations properly.

stevenp
Posts: 26
Joined: Wed Jan 31, 2007 3:29 am

Re: Pulling data from an external file

Post by stevenp » Thu Feb 22, 2007 7:47 pm

quailcreek wrote:Hello once again,
Does Rev support an INI type external file structure? I want to pull information for an external file.

[objectName]
color=red
highlighted=false


Thanks
Tom
Tom,

Coming from a Windows background I know what you are looking for. Windows has API's specifically for INI file access whereas Revolution is a cross-platform development system so specific OS functions like that may not be included (but in this case should be easily remedied with some home brewed functions :)).

I am very new to Revolution so I'll take this as a simple learning task and see if I can write up some simple functions for handling INI file access. It should be relatively easy (except I am so new to Revolution :)). I may not be home until late tonight but I'll see what I can do.

-Steven

quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm
Location: McKenna, WA

Post by quailcreek » Thu Feb 22, 2007 9:07 pm

Hi marielle, stevenp and Mark,
I'm not trying to be difficult and I apologies if I came across that way. I completely understand the xplatform capability issues. That's one of the things I like about RR. I'm not one to throw the baby out with the bath water and I very much like many of the things and ways RR works. If there is a way to accomplish what I need to with existing "built-in" code or with something more custom, I'm OK with that. I'm not up to speed with RR yet hence my series of questions. If anyone has suggestions on alternate ways of accomplishing this task I would be interested to hear them. If a better explanation of how the INI files work would help, let me know and I’ll try to be more explicit.

Respectfully
Tom

marielle
Livecode Opensource Backer
Livecode Opensource Backer

Post by marielle » Thu Feb 22, 2007 11:46 pm

quailcreek wrote:I'm not trying to be difficult and I apologies if I came across that way.
Tom,

We all understand this. It is a difficult exercise to express criticisms as it is a difficult exercise to answer them without coming across as trying to punish you for your heresies ;-).

It's perfectly alright to have needs that are not well cared for by RR ;-). This is correct, there is no good handling of ini files that comes out of the box :-).
quailcreek wrote:If a better explanation of how the INI files work would help, let me know and I’ll try to be more explicit.
If you have some hope that taking the time to do so may have a positive outcome for you, yes, please do so. :-) The problem you are interested in is somewhat similar to the reading and writing of a JSON file and I would be interested in solving that problem.

Marielle

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Fri Feb 23, 2007 1:36 am

quailcreek wrote:But if RR can't handle reading and saving information to an external file better than this then, sadly, I guess I'm going to have to stay with Toolbook.
Better than what? I gave you a script reads the required information. All you need to do is call that simple function. How could this be done "better"?

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm
Location: McKenna, WA

Post by quailcreek » Sat Mar 03, 2007 5:38 pm

Hi All,
Sorry for not responding sooner but work completely ties me up from time to time. First, Mark. Your script works great. There were issues with my INI files that had to be addresses. Once I figured that you’re your script indeed performs almost exactly the way it works in windows. Please don't be offended by any earlier posts.

Allow me to explain where I’m.at. I have a stand alone app in Toolbook that I have been working on for a very long time. Couple that with Toolbook promising a 32 bit upgrade for a couple of years and just now providing a bata copy. (I’m not impressed) My frustration has only to do with trying to make a decision on whether to ride out the Toolbook issues or sort of start over with RR. I started my computer life long ago with a Mac and HyperCard so it’s not as daunting a task as it might have been to switch over to RR.

Also, because I’m trying to see if I can convert my app to RR I was attempting to accomplish the conversion with as little rework as possible. Therefore I was looking for a direct correlation between TB and RR. What I should have done and would have, time and frustration level permitting, was state what I wanted to accomplish and asked how to do it in RR. So, Mark if you are still willing I’d appreciate a bit more help.

Respectfully
Tom

Post Reply

Return to “Talking LiveCode”