Compare variable after extracting from ReadText()

What I am trying to do below on Line 1 is to get the text value by using the ReadText() Function and set it into myString variable. On Line 2 I have printed the value of the variable and it shows the correct value which I have given within the search rectangle.
However, On Line 3 when I compare the value of myString variable with the hard coded string it always executes the else block.

Can anyone please help?

set myString to ReadText(("Rect_A","Rect_B"))
Log myString

if myString equals "Text Read from the Rectangle area" then
Log "Success"
Log "Failure"
This is most likely due to a line ending character (or maybe a space) on the end of the value read by the ReadText(). You might be able to address it by just adding:
Delete the last character of myString
Before making the comparison.

Thanks a lot… That worked! :slight_smile: