Directly from Apple, it says you can use the escape:
Option 1:
Special String Characters
The backslash (\) and double-quote (") characters have special meaning
in text. AppleScript encloses text in double-quote characters and uses
the backslash character to represent return (\r), tab (\t), and
linefeed (\n) characters (described below). So if you want to include
an actual backslash or double-quote character in a text object, you
must use the equivalent two-character sequence. As a convenience,
AppleScript also provides the text constant quote, which has the value
\".
Table 6-1 Special characters in text Character To insert in text
Backslash character (\) \\ Double quote (") \" quote (text constant)
Option 2
On that same page, Apple says you can use quote
to insert \"
instead:
set myString to "this is a " & quote & "quoted" & quote & " text."
Option 3
Another option found is:
set inString to "quoted"
set myString to "this is a " & quoted form of inString & " text."
Edit: Though, you said that last one outputs this is 'quoted' text
.
1The output of that is "this is a 'quoted' text.". It didn't work... – DevRandom – 2012-12-17T16:05:40.820
Option 1 and 2 gives "this is a "quoted" text." and Option 3 gives not real quotes, "this is a 'quoted' text." – DevRandom – 2012-12-17T16:33:56.347
@ThePhone Understood, just quoting directly from the Apple Developer Docs. Hopefully someone can enlighten us on why that's not working. – nerdwaller – 2012-12-17T17:23:01.640
1
quoted form of
is meant for escaping strings fordo shell script
. – Lri – 2012-12-18T05:22:18.183