开发者

Get text under mouse cursor in mac osx leopard/snow leopard

is there any idea for getting the text under the mouse cursor?

I'm trying to build a dictionary app, that pops up a panel of translates when mouse hangs over a word.

I took a look at the accessiblity apis, and it only can find the current ui element, but not the current word...

my last choice will be makeing screenshots frequently, and do开发者_如何学Pythoning ocr... that'll be cpu consuming, I don't like that..

any idea for this? thanks in advance!


While it is possible to do this via supported mechanisms (Spell Catcher X does), it's very hard to get right across a wide range of applications. Take a look at the page on Direct Correct—there are 3 mechanisms supported, none of which work perfectly, etc. etc.

Apple's Dictionary app already supports this kind of pop-up dictionary lookup, which works in many applications. You can create custom dictionaries for it, if you just need word-by-word translation (for example, Apple includes a Japanese-English dictionary). You can reorder reference sources in Dictionary's Preferences to put your dictionary first, if you want.

Otherwise, I'd suggest the OCR route. You don't need to take screenshots frequently, just when the user requests translation, right?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜