Clever OCR pipe-dream

Hey Logan,

Sensetalk Pattern for Text is the answer:

repeat for each item in ListOfThingsToClick
	put "Word to find:" && it
	set mypattern to <not preceded by  (1 to 2 characters) , it, not followed by (many  characters) >
	put imagelocation(text:mypattern)
end repeat

How to “read” it: Find the word apple this has not any one or two characters before and any number of characters behind.

Here is another example for Sensetalk pattern for an unknown version number on screen.

Here is the docu for sensetalk patterns. Its essentially a more readable regular expression.

put Mypattern // prints the regular expression (?<!(?:.{1,2}?))Apple(?!(?:.+))

Sensetalk pattern for text searches are powerful. Just takes some training to master them. Trust me its worth the effort.

Cheers,
Karsten

2 Likes