What's wrong with my code (URL)[Solved]

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
atout66
Posts: 266
Joined: Wed Feb 02, 2011 12:31 pm

What's wrong with my code (URL)[Solved]

Post by atout66 » Fri May 15, 2015 9:21 am

Hi to all,

Could you have a look at this code below and tell me what's wrong with it.

Code: Select all

put lesPreferences into URL "file:gLePathPreferences"
I'm not supposed to open the file first with URL, right ?
So, after debugging I can say that the var <lesPreferences > is not empty. It's a list with one parameter by line;
The global var <gLePathPreferences> is correct and gives the full path;
The file "preferences.txt" already exist;
The <into> word is supposed to replace the old data by the news...
I've been following lessons and the dictionnary and I don't understang where is the mistake...

Thanks in advance, Jean-Paul.
Last edited by atout66 on Fri May 15, 2015 11:18 am, edited 1 time in total.
Discovering LiveCode Community 6.5.2.

atout66
Posts: 266
Joined: Wed Feb 02, 2011 12:31 pm

Re: What's wrong with my code (URL)

Post by atout66 » Fri May 15, 2015 11:18 am

I find it out by setting the <defaultFolder> path to the folder needed and I changed the code by:

Code: Select all

put lesPreferences into URL "file:preferences.txt" 
That way it's OK.

Cheers, Jean-Paul.
Discovering LiveCode Community 6.5.2.

Klaus
Posts: 14267
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: What's wrong with my code (URL)[Solved]

Post by Klaus » Fri May 15, 2015 12:40 pm

Bonjour Jean-Paul,
The global var <gLePathPreferences> is correct and gives the full path;
you were not passing your global variable as VARIABLE but as the filename!

Don't mess around with the defaultfolder and just do this:

Code: Select all

...
put lesPreferences into URL ("file:" & gLePathPreferences)
...
:D


Best

Klaus

atout66
Posts: 266
Joined: Wed Feb 02, 2011 12:31 pm

Re: What's wrong with my code (URL)[Solved]

Post by atout66 » Fri May 15, 2015 1:42 pm

Thanks for the advice Klaus ;-)

When I think that just a

Code: Select all

&
makes the difference :mrgreen:

Regards, Jean-Paul.
Discovering LiveCode Community 6.5.2.

Klaus
Posts: 14267
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: What's wrong with my code (URL)[Solved]

Post by Klaus » Sat May 16, 2015 12:04 pm

Not only the & but also some additional missing quotes! :D

atout66
Posts: 266
Joined: Wed Feb 02, 2011 12:31 pm

Re: What's wrong with my code (URL)[Solved]

Post by atout66 » Sat May 16, 2015 1:02 pm

Ah right, I didn't notice this detail too !
Discovering LiveCode Community 6.5.2.

Klaus
Posts: 14267
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: What's wrong with my code (URL)[Solved]

Post by Klaus » Sat May 16, 2015 1:10 pm

atout66 wrote:Ah right, I didn't notice this detail too !
Yes, that will make the difference between a VARIABLE and a STRING! :D

Post Reply