On Sep 30, 2005, at 3:47 AM, David Niemeijer wrote:
Hi,
I have been wondering what the best way is to trigger Edit Menu
commands in other applications. I noticed that in the Speech System
Preferences (under the Text to Speech) tab there is a feature that
allows the user to speak any selected text when a particular
keyboard shortcut is used. When using that key combination the
front application's edit menu briefly highlights, which implies
that it triggers a copy. However, I am assuming it cannot trigger
that copy through sending the cmd-C keyboard shortcut because the
user may already be holding down say control-shift-K to trigger the
speak selected text function so sending cmd-C would actually result
in control-shift-cmd-C. Anyway, that is what I would imagine would
happen. Does anyone here know how Apple does it and wether it is a
public thing that other apps can also use? Perhaps I am missing
something extremely obvious...
Maybe through the accessibility API? You can invoke the AXPress
action on a menu item and the Menu Manager will attempt to fool the
app into calling MenuSelect.