Working with InDesign constants like thin space


I’m trying to detect whether the last paragraph, or the penultimate paragraph, in a text frame contains a thin space. The Applescript dictionary has nothing in it for “constant”, “thin space” or “enumeration” so I’m trying to understand how to work with this kind of character.

I have something sort of working, but I was wondering what the best technique is for CC. This doesn’t work:

tell application id "com.adobe.indesign"
	set thinSpace to thin space
	tell document 1
		tell page 1
			set lastPara to a reference to paragraph -1 of text frame "column2"
			if (contents of lastPara) contains thinSpace then
				set theAnswer to "Yes"
				set theAnswer to "No"
			end if
			return theAnswer --> returns No, which is wrong
		end tell
	end tell
end tell

However, if I know the position of the thin space, this works:

		if (character -2 of (contents of lastPara)) contains thinSpace then

Which doesn’t make sense to me right now – do “contain” and/or “is in” not work with these types of characters in certain situations? Is there a way to get them to work?

Can anyone explain how to work with characters like thin space? Like maybe how to test for unicode numbers or something similar?

Thanks in advance for any insights, pointers to documentation, or some examples! -k

Browser: Safari 605.1.15
Operating System: macOS 10.14

Hi. White spaces are character level attributes and can only be detected at that scale.
This would work:

tell application "Adobe InDesign CS3"'s document 1
	tell text frame 1 to paragraph -1's characters
end tell

They can be more easily detected en masse by targeting with a find.

tell application "Adobe InDesign CS3"
	set find grep preferences's find what to "~<"
	find grep document 1's text frames's paragraph -1
end tell

A grep find is perhaps a bit of overkill when a simple text find will do (at least, it will in the current version):

tell application id "com.adobe.InDesign"
	set find text preferences to nothing -- clear any existing stuff
	set find text preferences's find what to "^<"
	find text document 1's text frames's paragraph -1
end tell

Thanks Marc and Shane. I think it’s odd that I can use “contains” to find an “e” but not a thin space. I will investigate the Find alternative!