Script to select X number of previous words

Share your favorite FastKeys commands
Post Reply
PekingDuckDog
Posts: 5
Joined: Oct 20th, ’15, 04:56

Post by PekingDuckDog » May 13th, ’16, 05:35

I'm a writer, and I would like a script that would select the last word, or the last two words, up to the last five words, and copy them to the FastKeys clipboard. These would be words or phrases that I'd use a few times in one document and then never need again, so putting them into a phrase file would take a lot of time.

Ideally, I could run a hotkey that would ask me for a number between 1 and 5, and then select that number of words. If five separate scripts (with five different hotkeys) would work better, that's OK, too.

Is what I'm asking for possible? Can anybody here supply this kind of script? I'm not great at computer languages; I tried to learn the difference between a function and an object once, and my head hurt for about three years.

Thanks!
User avatar
Tom
Posts: 791
Joined: Nov 24th, ’15, 23:39

Post by Tom » May 13th, ’16, 12:21

easy... make a shortcut, Type: Command. :D

Code: Select all

InputBox, no,, Number of words:,,200,130
Send ^+{Left %no%}
Send ^c
Although it's probably faster just to Crtl+Shift+Left couple of times...
PekingDuckDog
Posts: 5
Joined: Oct 20th, ’15, 04:56

Post by PekingDuckDog » May 14th, ’16, 04:25

Thanks - it works great!

You're right, in many cases just Ctrl-Shift-Left is faster, especially for 1 or 2 words. But I got used to working this way in WordPerfect (it is very easy to record macros in WordPerfect without much programming), and I've been wanting to have it available more globally.

FastKeys is probably the smartest $10 I ever spent. Again, thanks!
Post Reply