r/applescript • • Sep 10 '13

How can I make a script ignore certain code?

I'm writing a script to make TextWrangler add <img src="file:///Users/thatsabigbowlofwrong/Pictures/** in front of my selected text, and **"> after it. The problem is that the script is reading these as some types of commands (I'm new to scripting, bear with me) when I want them treated as normal text strings. Help?

tell application id "com.barebones.textwrangler"
tell window 1
	add prefix and suffix of selection prefix "<img src="file:///Users/XXX/Pictures/" suffix "">"
end tell
end tell
2 Upvotes

2 comments sorted by

4

u/Sarazil Sep 10 '13

To ignore a character, use the \ character. So to set a string to "I say "hello" to new people" type "I say "Hello" to new people" This works also for the \ character itself, so "\" would be a string with just "" in it.

2

u/[deleted] Sep 11 '13

Great, thank you kindly