basic put URL question

Klaus Major klaus at major-k.de
Sun Apr 18 13:15:21 EDT 2004


Hi Rich,

> I can't seem to make Rev retrieve text and put it in a field. When I 
> use:
>
> [put URL "file:/Users/laguer/Documents/Revolutioní/exp í/test.2" 
> into field "Field 1"]
>
> All I get is a blinking cursor in Field 1.
>
>  I checked the path file by using the "answer file" cmd:
>
> answer file "Import text from what file:" of type "TEXT"
>   if it is empty then
>     put "Bingo!" into field "Field 1"
>     exit to top
>   else
>     put it into field "Field 1"
>   end if
>
>
> When I use this and select the file "test.2", I get the path to the 
> file "test.2"  in Field 1, not the contents of the file.

That's correct behaviour, since "it" will just contains that path...

> It doesn't work the other direction either. When I try to use the 
> script:
>
> put "Bingo!" into URL "file://Users/laguer/Documents/Revolutioní/exp 
> í/test.2.txt"

Looks like there is one slash to much before "Users", try:

put "Bingo!" into URL "file:/Users/laguer/Documents/Revolutioní/exp 
í/test.2.txt"

> There is no change in the file test.2.
>
> So, I suspect that I'm doing something very basic wrong...but what?

You habve to build the correct string for the url syntax first!

Do this:

answer file "Import text from what file:" of type "TEXT"
   if it is empty then
     put "Bingo!" into field "Field 1"
     exit to top
   else
     put URL("file:" & it) into field "Field 1"
   end if

Hope that helps...

> Thanks,
>
> Rich Lague

Regards

Klaus Major
klaus at major-k.de
www.major-k.de



More information about the use-livecode mailing list