Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 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:
http://lists.apple.com/mailman/options/accessibility-dev/email@hidden

This email sent to email@hidden

References: 
 >Accessibility and UIInspector to find text under cursor (From: Gary Yuen <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.