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: Gary Yuen <email@hidden>
- Date: Mon, 14 Aug 2006 14:40:29 -0700
Hi Bill,
Thank you very much. I've probably only spent a few months with Cocoa
and at many times feel lost. And when I try to do something new,
it's usually months or years after the last time I touched Cocoa; so
I often have to figure out what I've done in the past. :)
I had seen parameterized attributes the other day in the docs and I
had the impression that would work. I found
AXUIElementCopyParameterizedAttributeValue (in AXUIElement.h) but
wasn't sure what parameterizedAttribute (the 2nd parameter) meant.
I'm not sure if it's some constant that tells the function what I'm
looking for.
Figuring out how to integrate this in an Input Manager might also be
quite a task for me. I have a previous input manager so I have that
part. I'm not sure if there are notifications or other methods I need
to overload to get the info. :) If you had any suggestions for areas
to explore, I would greatly appreciate it.
I've seen the AX* header files though have yet to find any
documentation about them. Then again, I've only been looking at the
Cocoa accessibility does. The UIBrowser example uses Carbon thought
it seems NSAccessibility will let me retrieve the info I want.
I had downloaded PreFab UI Browser yesterday but haven't yet explored
all it can do. I will check it out.
Thanks again Bill.
Gary
在 2006-8-14,下午2:14,Bill Cheeseman 写道:
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