Re: Send events to AppleScript
Re: Send events to AppleScript
- Subject: Re: Send events to AppleScript
- From: has <email@hidden>
- Date: Sat, 21 Mar 2009 16:28:32 +0000
On Mar 21, 2009, at 12:09 PM, Тимофей Даньшин wrote:
Well, I'm writing a "translation memory" application, which is a
program that grabs sentence by sentence from a given text (that
needs translating), asks the user to translate that sentence and
stores the translation and the original in a database. If the user
comes across the same sentence again in the future, he or she will
not need to translate it again.
I thought i would take the TextEdit app as the text editing part of
my project, but as I wrote the database management and the search
parts, it turned out that TextEdit is not capable of correctly
interpreting word files or RTF's (ie it ignores footnotes, headers/
footers and a lot of other stuff). That is why I am trying to find
out how i can communicate with Word or Pages.
As far as what I would want from an AppleScript (if I were to use
AppleScript) is to be able to receive notifications from Word when,
for example, the user has hit a certain key combination, to know
where the insertion point (or selection) is in Word and to receive
notifications when it moves, to be notified when a user is trying to
edit something and prevent him/her from doing so if that part of the
text should not be edited.
Receiving those notifications, that script would just redirect them
to my application and receive responses to them and redirect them to
Word.
It is rare to find applications that provide notifications, and almost
unheard of for them to provide notifications of minor events such as
text edits. You certainly won't get the sort of notifications you
describe from TextEdit, Word or Pages. ISTR a third-party tool that
allows you to attach AppleScripts to the GUI objects of another
application, but that sort of thing is inherently hackish, prone to
breakage, and liable not to go down too well with increasingly
security conscious software and users. I suspect your best bet would
be to poll the application, bearing in mind that might create its own
issues (e.g. performance/responsiveness).
HTH
has
--
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden