Hmm! Chip, I need get back once more.

I said it seemed to work on a webpage. That is not the case. I meant to say, that the FocusedWindow.Control.Selection, does work in Notepad - which has an edit box, of course.

But it seems a webpage - in browse mode - does not work. It throws the same error on you. Telling that the object does not support the Selection property or method.

Any other way around?

Thanks again, and sorry for the confusion.

----- Original Message ----- From: "Chip Orange" <[email protected]>
To: <[email protected]>
Sent: Tuesday, September 06, 2011 1:25 AM
Subject: RE: How to retrieve marked text?


Hi David,

You have at least two ways of doing this that I know about. the easiest for you is built into the window-eyes object model, and that is, anything which has text which can be selected is almost always an editbox (or richEditBox) control. you can look in the app developers manual under objects, and then the controls topic, and in there the types of controls topic, and finally in
there you'll find the editbox entry.  It's selection property returns a
string of the text which is selected.

I tried this out on notepad; and like most applications, it's focused window
is nothing but one editbox control, so I just used the two lines below in
immediate mode (after I had opened a file and selected some text), to see
what the text was:

set c=focusedwindow.control
print c.selection

If you need to know more than what text is selected (such as whether it's
bolded etc.), then you'll have to likely do this another way; but if just
the text will do what you want, then this should work in any editbox or
richeditbox control.

hth,

Chip



________________________________

From: David [mailto:[email protected]]
Sent: Monday, September 05, 2011 5:02 PM
To: [email protected]
Subject: Re: How to retrieve marked text?


Thanks for the idea. It might of course eventually work; but would require a
chunk of coding.

GW staff, why not have a method implemented in the Toolkit, that would
return marked text right away?



----- Original Message ----- From: Jared Wright <mailto:[email protected]>
To: [email protected]
Sent: Monday, September 05, 2011 10:51 PM
Subject: Re: How to retrieve marked text?


            FYI there's a hotkey that does this in Wineyes itself,
Ctrl+Shift+M by default. Don't know if there's a way to get at it through
the object model or not. I guess you could overload the hotkey and hook
onSpeak and dump what it says into a string if nothing else.
On 9/5/2011 1:50 PM, David wrote:

In my app, I want to be able to retrieve the text a user has
marked. That is, if you for instance are in a text document, and use the
Shift-Arrow keys to mark a text, then hit the hotkey of my app, the app
should retrieve the text you have marked, and do its job with the retrieved text. Hopefully this could be performed whether you are in a text editor, in browse mode on a wbpage, or from any other situation where it is possible to
mark text the normal way.

Is there an easy to reach method in WE to achieve this?

Thanks,





Reply via email to