Re: Accessibility and UIInspector to find text under cursor
Re: Accessibility and UIInspector to find text under cursor
- Subject: Re: Accessibility and UIInspector to find text under cursor
- From: Bill Cheeseman <email@hidden>
- Date: Mon, 14 Aug 2006 17:14:50 -0400
- Thread-topic: Accessibility and UIInspector to find text under cursor
on 2006-08-14 10:50 AM, Gary Yuen at email@hidden wrote:
> I'd like to make an Input Manager for Safari that can find the
> current word, letter, or Asian character under the cursor. Looking
> thru Accessibility and the UIInspector, I see a lot of the work is
> done; Accessibility can easily get text although I'm not sure if it
> can find the specific word under the cursor.
>
> I'm hoping someone can tell me if this is the right approach or if
> there is a better method. Thanks for your time.
You're on the right track. What you want to read is the documentation for
the so-called "parameterized attributes," which were introduced in Panther
or Tiger's implementation of the accessibility API. They give you access by
screen coordinates to the text under the mouse, which you can parse by
glyph, word, line, etc. using the parameterized attributes.
To see how they work, download the free 30-day trial version of PreFab UI
Browser at www.prefab.com/uibrowser, and use it to examine the parameterized
attributes for a text view in, say, a TextEdit document. UI Browser lets you
enter numerical parameters and then calls the parameterized attribute
functions to get the result, which is typically shown as the glyph, word,
line or text block you requested. By default, UI Browser shows you the line
the mouse was over, but you can code this as you like. UI Browser's online
Help (under the Help menu) explains how they work.
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com
PreFab Software - http://www.prefab.com/scripting.html
The AppleScript Sourcebook - http://www.AppleScriptSourcebook.com
Vermont Recipes - http://www.stepwise.com/Articles/VermontRecipes
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Accessibility-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden