a tip for newbies (like me) part 3, Return of the Newbie

BCE mark at bcesouth.com
Wed Mar 20 16:45:00 EST 2002


Yikes!  You are absolutely right!!!  And thanks for pointing out my "ask"
typo --- that is actually "answer" in my script, I just screwed it all up
when I went to type the email.  And it definitely needs to be "put URL".  I
stand completely corrected.  My tip for newbies has caused havoc --- lol.

Dar, thanks for your comments too.  Okay, I'll be more careful the next time
I put a tip in!

Mark Paris

----- Original Message -----
From: "Yates, Glen" <JAMES.G.YATES at saic.com>
To: <use-revolution at lists.runrev.com>
Sent: Wednesday, March 20, 2002 3:24 PM
Subject: RE: a tip for newbies (like me)

> Analyzing this had me thrown, until I realized you were missing 1 key
> of information, your line starting with "put" should really be:
> put url ("file:" & it) into field "myField"
> With this you can see that the use of parentheses here is not just a
> case but follows the rules for the parsing of all arguments to containers,
> functions, etc.
> When you use "put url" it expects a container, so the next item listed is
> the container it uses, in the example without parens that would be:
> put url "file:" & it into field "myField"
> So in this case the container for put url is only "file:", which since it
> probably doesn't point to an actual file returns an empty string, which
> gets concatenated with "it" and put into the field.
> When parens are used however:
> put url ("file:" & it) into field "myField"
> The parens force the concatenation of "file:" & it to occur before being
> evaluated as a container of type "url", so now that container evaluates to
> file that actually exists and its contents get put into the field.
> Received more messages in this thread while typing this message:
> (from another message)
> >Me too!  I believe it will work with both "put" and "put URL".  But the
> >parentheses are apparently the key to using variables there.  There is
> >probably another way to do it, but that is the only method I know right
> now.
> >And in response to these messages, no you cannot leave out "url" in this
> >construct and expect the contents of the file to be put into your field
> No, you must use "put url" if your objective is to put the contents of the
> file into the field. Otherwise you would have to do an "open file" to get
> the file contents.
> Also one more point, the "ask file" below should really be:
> answer file "What file?"
> As, "ask file" is for saving files, and "answer file" is for
> locating/opening them.
> -Glen Yates
> BCE wrote:
> > The RIGHT method: (at least for me, on windows)
> >
> > on mouseup
> >     ask file "What file?"
> >     put ("file:" & it) into field "myField"
> > end mouseup
> >
> > Notice the parentheses in the second line --- they make the
> > difference.
> > Otherwise, just the name of the file is put into the field,
> > and not the
> > contents, and a lot of hair pulling occurs.  Apparently if you're
> > concantenating a variable and some text into the name of a
> > file, this needs
> > to be done.
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution

More information about the use-livecode mailing list