Hi David,

sorry for the delay in answering this for you.

I just found today the .highlight property of the application object, which
returns a clips collection of any selected (marked) text.  I tried it out by
opening an internet explorer web page, then opened an immediate mode window
and typed in:

function speakhl(x1): speak highlight.clipstext: end function

set x=keyboard.registerhotkey("control-shift-z", "speakhl", , "")

going back to my web page, selecting some text, and pressing my hotkey.  the
selected text was read out.
and   it should work anywhere.

hth,

Chip


-----Original Message-----
From: David [mailto:[email protected]] 
Sent: Saturday, September 10, 2011 9:07 PM
To: [email protected]
Subject: Re: How to retrieve marked text?

Chip, and the rest:

I did try your suggested way of retrieving the marked text, by use of the
FocusedWindow.Control. Here is my findings.

Firstly, if you are focused on an edit box, i.e you are positioned in a
Notepad document, the approach you gave me Chip, is working perfectly. 
Thanks.

The problem arises, if you are focused on a non-Edit box. Try for instance
the approach, if you are in a window under Explorer. That is, Open Windows
Explorer, and try to do the following two lines:

    Set FWC = FocusedWindow.Control
    ST = FWC.Selection

. You will get the following error message:

Object doesn't support this property or method: 'FWC.Selection'
< 0x800A01B6 >.

Any fix for this? Is there a way for my app to ignore the Selection, if it
cannot be retrieved in a given context?

I need the routine in my Currency Calculator. The user should be able to
mark the text holding a currency value (like a price), for instance on a
webpage. This seems to work with the above approach. But including the two
lines in the app, and then running the app from a non-edit boxed window,
causes the error shown above. I want to allow the user to run the app - for
manual entry of the currency value - from anywhere. Why I need a way to have
the app ignore the Selected Text session, if it cannot handle it in a given
case.

Any fix?

Thanks for helping out.

----- 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