capture text from applications

i want to capture all text appearing on the screen, ie whatever the user is typing or whatever text contained in the application the user opens...
how to do that... can anyone guide me plz...

one solution is to hook the XDrawString library , but by doing that we are able to get the text from only console and Xedit edtor. If we open mozilla or any other application, its not working... any idea on how to proceed?

Do you want it to just take a series of graphical snapshots, or somehow reach in and grab the actual rawtext data from the application? The latter might be a pretty tall order given these are graphical applications. Snapshots can be taken with the xsnap tool.

If you're talking about a shell session (tty or pty), then man script

(I don't think that's what you're talking about, but from the subject line this is just here for those who search on it)

I want to grab the actual text displayed on the application. THere are few functions which the apllications calls before displaying the text.. like for eg: there is a function XDrawString present in Xlib which is called every time user types in it. i hooked that function and was able to capture what ever user did on that editor... but now if i open Mozilla, that function is not gettin called at all.. ie it is using some other libraries...if u can throw some light on this plz....

I believe mozilla uses the freetype library in most cases... But no program is obliged to draw text in exactly the way you want. Even if you manage to intercept the text-drawing libraries of each and every program on your system you may find that it doesn't draw text in the right order to make sense when captured, or might render individual glyphs only once then draw the rest just by placing bitmaps, etc. Graphics is not console and will not behave like one.

Actually on Linux, while using Mozilla, XdrawString is getting called. But now i was tying that on Xandros Flavour, and that function was not gettin called. ie it is using some different libraries.
how can solve this problem... ay feasible solution u can think of or any other approach?