is it possible to have a script that waits for a keystroke?
Model: PowerBook 15in 1.5Ghz
AppleScript: 1.10
Browser: Safari 412
Operating System: Mac OS X (10.4)
is it possible to have a script that waits for a keystroke?
Model: PowerBook 15in 1.5Ghz
AppleScript: 1.10
Browser: Safari 412
Operating System: Mac OS X (10.4)
You have been waiting for an answer quite long already!
I can only hope that this answer triggers some response, as I want to know the same thing…
More specifically, I want a script to run in the background and keep track of all the keys typed in a text editor window.
The script keeps a little string with the last 5 keystrokes, and after each keystroke adds that one to the string, drops the oldest one, and checks if there is a match with a list of search strings. If so, it posts a number of keystroke events, typically a few Backspaces and one or several keystrokes.
So in short it’s an input method to help typists type in a certain complex font.
I’ve found several references to posting keystroke events, so I think that’ll work out. But nowhere do I find anything about capturing keystroke events. Any suggestions welcome!
Model: G4
Operating System: Mac OS X (10.4)
I think you’d have better luck capturing what was typed from the document than you will trying to find a key logger.
As far as I know the answer is nope. There was a scripting addition back in the OS 9 days that would capture a modifier key (or at least that’s all I remember using) that I used to launch a series of preferences dialogs but as far as I know it was never updated for OS X. Your best bet might be to use AppleScript Studio and see if there are some cocoa objects that you could incorporate into the application which would do the trick, but then again it might be just as easy to learn object C and do it all in that.
Thanks for the response! Could you give me an idea (or point to an example) how to “capture what was typed from the document”? It sounds better than capturing keystrokes, too, because the user can switch documents or applications without having to switch the script off and back on.
The possibility with a Cocoa object for AS Studio sounds good, too. Any hints how/where to find candidates?