sending group of key strokes, one at a time

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
oontzing
Posts: 2
Joined: 12 Dec 2018, 00:35

sending group of key strokes, one at a time

12 Dec 2018, 00:40

I'm having trouble writing a script to do the following (hopefully this is pretty simple):

once I press a keystroke (say, CTRL-ALT-L), I'd like AutoHotkey to send F4, F5, F6, F7, F8, in that order, but only one at a time. So the first time I press CTRL-ALT-L, send F4. The next time I press it, send F5, etc... Once it gets to F8, the next one should start over and send F4 again, and so on.

Any thoughts on this?
Rohwedder
Posts: 7655
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: sending group of key strokes, one at a time

12 Dec 2018, 01:46

Hallo,
try:

Code: Select all

Keys := ["F4", "F5", "F6", "F7", "F8"]
No := 0
^!l::Send,% "{" Keys[Mod(No++,Keys.Length())+1] "}"
oontzing
Posts: 2
Joined: 12 Dec 2018, 00:35

Re: sending group of key strokes, one at a time

12 Dec 2018, 08:04

That works beautifully, thank you! How would I limit the keystrokes to being sent when a specific window is current? ie Only send keystrokes when working in a particular .exe file on the screen?
User avatar
Hellbent
Posts: 2109
Joined: 23 Sep 2017, 13:34

Re: sending group of key strokes, one at a time

12 Dec 2018, 08:31

oontzing wrote:
12 Dec 2018, 08:04
That works beautifully, thank you! How would I limit the keystrokes to being sent when a specific window is current? ie Only send keystrokes when working in a particular .exe file on the screen?

It sounds like you are looking for something like this

Code: Select all

#IfWinActive,           put the title of the window you want to use here

;put all the hotkeys that you want to use when that window is active here

#if  ; this exits the #If directive so that this window doesn't have to be active for other hotkeys to work.





Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 238 guests