Jump to content

Getting highlighted text in windows


Fangs78
 Share

Recommended Posts

Hello.

Is it possible to get highlighted text using AutoIT?

What I mean is, can you make a script which executes when something is

highlighted (in any program) and gets the highlighted text?

I know it is possible some way or another, as a program like JAWS does

this to read aloud highlighted text. I just wonder how they did it.

regards,

Tomas

Link to comment
Share on other sites

Hello.

Is it possible to get highlighted text using AutoIT?

What I mean is, can you make a script which executes when something is

highlighted (in any program) and gets the highlighted text?

I know it is possible some way or another, as a program like JAWS does

this to read aloud highlighted text. I just wonder how they did it.

regards,

Tomas

I do not know how JAWS does it but try this

; Press Esc to terminate script

HotKeySet("{ESC}", "Terminate")
HotKeySet("{F3}", "Showhighlight") 

While 1
    Sleep(100)
WEnd


Func Terminate()
    Exit 0
EndFunc

Func Showhighlight()
    Send("^{INS}")
    $text = ClipGet()
    MsgBox(0,"What is highlighted", $text)
EndFunc


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

Thanks!

I'll try that right away.

Edit :

I read and understood the code now. What it does is copy to the clipboard and

read from it, when someone hits F3.

I already thought of this myself, but didn't know that ctrl-ins does clipboard copying on all programs (nice!).

I really need to catch the event when anything is selected...does this exist in the win32 api? I have searched

for it, but have only found it for EDIT and RICHEDIT controls, which isn't enough.

I might have to settle for the user hitting a key to execute the get highlighted text func (I guess I could use the mouse-drag event

or shift-arrow system events, but would like to avoid it)

Edited by Fangs78
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...