[TxMt] Emulating keyboard activity with commands

Steven Arnold thoth_amon at mac.com
Tue Oct 2 23:43:22 UTC 2012


Let me try to sharpen the point of my last question in a way that will make macros mostly unnecessary for me.  I'd like to be able to emulate keyboard activity using commands.

One simple example is hitting backspace.  To delete the current line, I can take the current line as input and replace it with "".  But, this merely deletes the content of the current line; it does not remove the entire line (the carriage return is still there).

I've tried things like:

print "\x08"
print "\b"

These give the literal text "<BS>" instead of actually acting as if I had hit the backspace key.

This is only one example.  I might want to emulate other "meta" keypresses too.  Even though the paste problem is solved with `pbpaste`, command-V would have worked too.  It would be nice to have the option of emulating those kinds of keypresses.

What's the best way to handle this kind of problem?

Thanks again for any information!
steven


More information about the textmate mailing list