• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Accessibility and UIInspector to find text under cursor
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accessibility and UIInspector to find text under cursor


  • Subject: Re: Accessibility and UIInspector to find text under cursor
  • From: Gary Yuen <email@hidden>
  • Date: Wed, 16 Aug 2006 18:30:25 -0700

Hi Bill,

I've looked into this further and am not sure if Accessibility can give me the specific word or character under the mouse. While using UI Browser and TextEdit, I see that some attributes for the text area are range for position and string for range. Do you know if it's possible to pass the mouse position to get the specific character under the mouse?

If AXUIElementCopyParameterizedAttributeValue is able to do this, I'm not sure what format the third parameter (parameter) needs to be in. The 2nd one (parameterized attribute) one seems to take constant like kAXRangeForPositionParameterizedAttribute and kAXStringForRangeParameterizedAttribute.

I'm most interested in text with Safari. When using the UI Browser with Safari, I don't see any attributes that would let me specific text more fine-grained than the entire area.

Any clues would be appreciated. I'm kind of stuck on this one point, how to go from the mouse position to the specific text under it.

Thanks.

Gary

On 2006-8-14, at 下午2:14, Bill Cheeseman wrote:

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 (Accessibility- email@hidden)
Help/Unsubscribe/Update your Subscription:
40mac.com


This email sent to email@hidden

_______________________________________________ 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
  • Follow-Ups:
    • Re: Accessibility and UIInspector to find text under cursor
      • From: Bill Cheeseman <email@hidden>
References: 
 >Re: Accessibility and UIInspector to find text under cursor (From: Bill Cheeseman <email@hidden>)

  • Prev by Date: Re: Accessibility and UIInspector to find text under cursor
  • Next by Date: Re: Accessibility and UIInspector to find text under cursor
  • Previous by thread: Re: Accessibility and UIInspector to find text under cursor
  • Next by thread: Re: Accessibility and UIInspector to find text under cursor
  • Index(es):
    • Date
    • Thread