Script to select X number of previous words

Share your favorite FastKeys commands
Posts: 5
Joined: Tue Oct 20, 2015 3:56 am

Script to select X number of previous words

PostPosted by PekingDuckDog » Fri May 13, 2016 4:35 am

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
Posts: 100
Joined: Tue Nov 24, 2015 11:39 pm

Re: Script to select X number of previous words

PostPosted by Tom » Fri May 13, 2016 11:21 am

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...

Posts: 5
Joined: Tue Oct 20, 2015 3:56 am

Re: Script to select X number of previous words

PostPosted by PekingDuckDog » Sat May 14, 2016 3:25 am

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!

Return to User Commands and Scripts

Who is online

Users browsing this forum: No registered users and 1 guest