Re: Quoted text?
Re: Quoted text?
- Subject: Re: Quoted text?
- From: Paul Berkowitz <email@hidden>
- Date: Wed, 17 Jan 2001 22:27:18 -0800
On 1/17/01 11:28 AM, "Michael Kern" <email@hidden> wrote:
>
I am having trouble creating a quoted text string. I9m following the
>
example in a book I have.
>
>
Script:
>
set x to "He said \"Oops.\" after dropping the plate." as string
>
get x
>
>
Result:
>
"He said \"Oops.\" after dropping the plate."
>
>
What I want:
>
"He said "Oops." after dropping the plate."
>
(see no slashes)
>
>
I DO NOT want the back slashes to appear in the string. I9ve tried it
>
without the as string9 on the end. I9ve also tried it with as text9 .
>
Nothing seems to work. I always get the back slashes.
>
>
How do I go about getting the quoted text into the variable?
You won't see the slashes anywhere but in AppleScript. if you put that text
into a document, via the script with the slashes, you'll see exactly this:
He said "Oops." after dropping the plate.
with no outside quotes around the whole thing. You can't do what you're
trying to do because it's bad syntax, both in English and in Applescript.
Since double-quotes in AppleScript mean "This is a string", literal
double-quotes have to be coded. AS uses the "escape" character \ to show
"What I mean here is a double-quote within a string." You won't see them in
a document or a dialog. Haven't you tried?
In AS, the " without the backslash means simply "This is the beginning of a
string" or "This is the end of a string". So your method will always error,
since the word 'Oops' after the second double-quote is OUTSIDE any quotes -
it's an undefined variable not even connected to the "set" command in any
way, nor to the string it follows (it doesn't have a "&", for example).
Just do it the way the book says, and it will be fine. try it - you'll see.
--
Paul Berkowitz
References: | |
| >Quoted text? (From: Michael Kern <email@hidden>) |