AppleScript - Syntax Help

Hi There

I'm trying to create a basic script that extracts some text from a webpage, but when I save I'm getting a Syntax error that I don't understand...

... please see screenshot.

The second Set (Role1Result) is working fine.

I'm a bit of a newbie at this, so any help really appreciated.

Here's the relevant bit of code pasted:

	set tid to AppleScript's text item delimiters -- save them for later.
	set AppleScript's text item delimiters to startText -- find the first one.
	set liste to text items of SearchText
	set AppleScript's text item delimiters to endText -- find the end one.
	set extracts to {}
	repeat with subText in liste
		if subText contains endText then
			copy text item 1 of subText to end of extracts
		end if
	end repeat
	set AppleScript's text item delimiters to tid -- back to original values.
	return extracts
end extractText



--- roles ---

set role0Result to extractText(input0, "      <dd class="result-lockup__highlight-keyword">
          <span data-anonymize="job-title" class="t-14 t-bold">", "</span>
            <span>
    at
    ")

set role1Result to extractText(input1, "      <dd class=\"result-lockup__highlight-keyword\">
          <span class=\"t-14 t-bold\">", "</span>
            <span>
")


You’re getting this error because you’re trying to include a quote (") inside a quoted string. Consider this:

set s to "Hello Cruel World!"
set s to "Hello "Cruel" World!"
set s to "Hello \"Cruel\" World!"

The first line works because the string contains no quotes. The second line generates a syntax error because it’s interpreted as "Hello " then Cruel then " World!". The third line works because the quotes inside the string are escaped using a slosh (\).

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

AppleScript - Syntax Help
 
 
Q