Script issue on getting text

שמואל רטבי

Hello all

Thank you to allwhose help was very useful so far.

In the following lines of script, I try to get text at the caret position :

                                FO = api.getFocusObject()

                                T = FO.makeTextInfo(textInfos.POSITION_CARET)


                                The Word = T.text


If the caret happens not to be at some character position, the expression


Causes an error (something like :

Invalid NVDAObject start point… or so

What is the simplest way to catch the error before it occurs and have TheWord = "Nothing at cursor position"

Note : I tried "Try" but I don't get out of it without some bones broken…

Thanks in advance



Join to automatically receive all group messages.