WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

How To
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Get Highlighted text from Any Window

 Keywords: Get Highlighted Text Any Window WinGetActive

It looks like a properly positioned TimeDelay before the SendKey is quite helpful. Here is the simplified code sample I came up with that seems to work well on Windows 7.
ClipPut('');initialize clipboard 
BoxOpen('Get Highlight Text From Any Window','Press Alt+F12 to get the highlighted text into the clipboard')  
While WaitForKey('!{F12}','','','','')
    title = WinGetActive()
    TimeDelay(0.5) ;IMPORTANT DO NOT REMOVE
    SendKeysTo(title, '^c')    
    data = ClipGet()
    if data == '' then continue
    Pause(title,data)
    ClipPut('')
EndWhile
Exit

Article ID:   W17927
Filename:   Get Highlighted text from Any Window.txt
File Created: 2014:01:07:15:09:18
Last Updated: 2014:01:07:15:09:18