How to repeat a type keystroke action multiple times

Hey Mitchell,

What kind of application?

Please provide more details.


I need N left and right arrows in the context of text editing in any application where you can edit text. That’s basically it.

Specifically, after copying the selection, replacing it with some other stuff, and pasting the former selection back, I want to reselect not just the former selection, but the characters I added. Since few applications provide a way to work with the selection, and those that do don’t make it easy, and in any case use different mechanisms from each other, I am left having to do this in a general way. I know how many characters there are in the copied selection, and I know how many characters I have added and where I added them. Thus, I can use a series of right and left arrows (some with shift down) to select the new text along with the old. But it is slow and strange.

No, I don’t know if these are characters, words, lines, paragraphs, or pages, or even which of these the application knows how to deal with.

Other than extensively AppleScriptable apps, I think you’re out of luck. Only individual arrow keys will have any chance of working reliably (no two applications define a “word” in the same way (except by random good luck), so Option-arrow keys wont work).

If you just want to move the cursor, you could do something like:

  • Set Find Pasteboard to “H3R3” (unique code)
  • Insert text “H3R3”
  • Paste One thing
  • Paste Another thing
  • Type Keystroke: Command-Shift-G
  • Type Keystroke: Delete

But you want to select, and there isn’t any way to “extend selection to Find location” (unfortunately!).