It will work when we terminate the line with Enter key.
It isn't working in the following case,
- Create a point type text item on the photoshop document.
- Write the line like "This is a" . Now press Shift+Enter key (Cursor will move to the next line).
- Write anything like "sample.".
- Now execute the script on this text item. It will return 1.