• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: insert a literal quote
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: Re: Filemaker Pro active window [Bug?]
  • Next by Date: Re: List of apps...
  • Previous by thread: Re: insert a literal quote
  • Next by thread: Re: Example: Can an AppleScript accept arguments
  • Index(es):
    • Date
    • Thread