Re: getting the key window from another application
Re: getting the key window from another application
- Subject: Re: getting the key window from another application
- From: Bill Cheeseman <email@hidden>
- Date: Fri, 06 May 2005 07:48:28 -0400
on 2005-05-06 12:00 AM, Keith Alperin at email@hidden wrote:
> I'm trying to interact with the first responder programatically. I'm
> most interested in manipulating text in in the focused text field,
> but there may be other cases where i will want to do something to
> whatever control is in focus.
You really can't do this sort of thing in plain-Vanilla Cocoa, because it
doesn't give you access to the programmatic structures in another
application.
Instead of the AppleScript suggestion, I would recommend that you consider
using the accessibility API. Apple builds accessibility into every standard
Carbon and Cocoa UI element, so it is actually more widely supported than
AppleScript. The accessibility API has a big learning curve, but it gives
you very broad and deep ability to read, set and manipulate UI elements in
any application, including very sophisticated text operations (including rtf
and attributed strings).
To see the accessibility API in action, get Apple's free UI Element
Inspector (Accessibility Inspector in Tiger), or download the 30-day free
trial version of PreFab UI Browser at <http://www.prefab.com/uibrowser/>.
--
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.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden