fetching text from the screen

Discussion in 'Python' started by Juergen Kareta, Jun 18, 2007.

  1. Hello list,

    I'm thinking about a python script which fetch some text from the screen
    independent of what application provides the text on the screen. In this
    regard it should be similar to the babylon software: www.babylon.com


    Here my thoughts:

    1) getting the mouse position
    2) calculate a adequate rectangle around the mouse position
    3) fetch the screen content in this rectangle
    4) use a OCR library to get the text out of 3)
    5) do something usefull with it.

    Has someone experiences with this task ? Is this a good roadmap or
    could someone think of a better way? Which OCR library shoud I use ?
    Found tesseract-ocr (linux, windows) and simpleOCR (bad, only windows
    (activeX).

    Thanks in advance for your replays.

    Jürgen
     
    Juergen Kareta, Jun 18, 2007
    #1
    1. Advertising

  2. En Mon, 18 Jun 2007 09:13:16 -0300, Juergen Kareta <>
    escribió:

    > I'm thinking about a python script which fetch some text from the screen
    > independent of what application provides the text on the screen. In this
    > regard it should be similar to the babylon software: www.babylon.com
    >
    >
    > Here my thoughts:
    >
    > 1) getting the mouse position
    > 2) calculate a adequate rectangle around the mouse position
    > 3) fetch the screen content in this rectangle
    > 4) use a OCR library to get the text out of 3)
    > 5) do something usefull with it.


    On Windows, I'd try first using WindowFromPoint to get a window handle,
    and the sending it a WM_GETTEXT message. This should work for all windowed
    controls that contain text of some kind. I'd use your generic approach
    when this doesn't work.

    --
    Gabriel Genellina
     
    Gabriel Genellina, Jun 19, 2007
    #2
    1. Advertising

  3. Gabriel Genellina schrieb:
    > En Mon, 18 Jun 2007 09:13:16 -0300, Juergen Kareta <>
    > escribió:
    >
    >> I'm thinking about a python script which fetch some text from the screen
    >> independent of what application provides the text on the screen. In this
    >> regard it should be similar to the babylon software: www.babylon.com
    >>
    >>
    >> Here my thoughts:
    >>
    >> 1) getting the mouse position
    >> 2) calculate a adequate rectangle around the mouse position
    >> 3) fetch the screen content in this rectangle
    >> 4) use a OCR library to get the text out of 3)
    >> 5) do something usefull with it.

    >
    >
    > On Windows, I'd try first using WindowFromPoint to get a window handle,
    > and the sending it a WM_GETTEXT message. This should work for all
    > windowed controls that contain text of some kind. I'd use your generic
    > approach when this doesn't work.
    >

    Hi Gabriel,

    thanks for your interesting suggestions. I'll try that to figure out,
    how it works in different situations.

    Jürgen
     
    Juergen Kareta, Jun 21, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Smugsboy
    Replies:
    6
    Views:
    4,534
    Hywel Jenkins
    Nov 30, 2005
  2. Bhavesh
    Replies:
    0
    Views:
    437
    Bhavesh
    Jul 16, 2007
  3. Bhavesh
    Replies:
    5
    Views:
    651
    Bhavesh
    Jul 18, 2007
  4. Bhavesh
    Replies:
    1
    Views:
    460
    Bhavesh
    Jul 17, 2007
  5. Bhavesh
    Replies:
    1
    Views:
    423
    Bhavesh
    Jul 17, 2007
Loading...

Share This Page