Page 1 of 1

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

Posted: Fri May 15, 2015 9:21 am
by atout66
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.

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

Posted: Fri May 15, 2015 11:18 am
by atout66
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.

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

Posted: Fri May 15, 2015 12:40 pm
by Klaus
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

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

Posted: Fri May 15, 2015 1:42 pm
by atout66
Thanks for the advice Klaus ;-)

When I think that just a

Code: Select all

&
makes the difference :mrgreen:

Regards, Jean-Paul.

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

Posted: Sat May 16, 2015 12:04 pm
by Klaus
Not only the & but also some additional missing quotes! :D

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

Posted: Sat May 16, 2015 1:02 pm
by atout66
Ah right, I didn't notice this detail too !

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

Posted: Sat May 16, 2015 1:10 pm
by Klaus
atout66 wrote:Ah right, I didn't notice this detail too !
Yes, that will make the difference between a VARIABLE and a STRING! :D