Re: insert a literal quote
Re: insert a literal quote
- Subject: Re: insert a literal quote
- From: has <email@hidden>
- Date: Mon, 1 Jul 2002 19:58:20 +0100
Matthew Smith wrote:
>
> I'm trying to create a web page with an applescript and don't know how
>
> to get the applescript to concatenate a text string containing a quote.
>
> For example, in the following line I receive an error message saying
>
> that the variable quote is not defined:
Nope, there's no 'quote' constant in AS, though there are 'space', 'tab'
and 'return' constants.
>
> set fileInfox to (((wrapper1 as string) & "View image only:" &
>
> (wrapper2 as string) & ("<a href=" & quote &
>
> "../images/%FILENAME%.jpg" & quote & " target=" & quote & "_parent" &
>
> quote & ">" as string) & ("%FILENAME%" as string) & "</a>" & wrapper3 as
>
> string) & return) as string
>
>
You can include a quote symbol in a sting by escaping it with a backslash.
Yep, double quotes and backslashes within strings must be escaped with a
backslash - see p82 of the AppleScript Language Guide for more info.
BTW, it's worth cleaning up the above code, removing the excess coercions
(i.e. you don't need to coerce a string to a string) to make it simpler and
more readable:
set fileInfox to wrapper1 & "View image only:" & wrapper2 &
"<a href=\"../images/%FILENAME%.jpg\" target=\"_parent\">%FILENAME%</a>" &
wrapper3 & return
[Note: this assumes that the 'wrapper1' variable always contains a string;
if not, you should leave that coercion in.]
has
--
http://www.barple.connectfree.co.uk/ -- The Little Page of Beta AppleScripts
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.