Combine function keys and numbers with a hotkey

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
Jimmyalenius
Posts: 2
Joined: 31 Mar 2023, 12:27

Combine function keys and numbers with a hotkey

Post by Jimmyalenius » 31 Mar 2023, 12:37

Hi! I need to combine function keys with numbers that should be activated in a certain order with a pause in between. So if, for example, I press ^#1::, I want the program to perceive that the F7 button is pressed, do a pause, and then the 1 button. How do I do that? I can only find examples for V1, but I want to use V2 for this.

Regards / Jimmy

User avatar
mikeyww
Posts: 26939
Joined: 09 Sep 2014, 18:38

Re: Combine function keys and numbers with a hotkey

Post by mikeyww » 31 Mar 2023, 12:44

Welcome to this AutoHotkey forum!

Code: Select all

#Requires AutoHotkey v2.0

#^1:: {
 SetKeyDelay 200
 SendEvent '{F7}1'
}

Rohwedder
Posts: 7645
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Combine function keys and numbers with a hotkey

Post by Rohwedder » 01 Apr 2023, 03:27

Hallo,
or:

Code: Select all

#Requires AutoHotkey v2.0
#^1::Send("{F7}"), Sleep(200), Send("1")
or to get the Sleep uninterruptibility of SetKeyDelay:

Code: Select all

#Requires AutoHotkey v2.0
#^1::Critical("On"), Send("{F7}"), Sleep(200), Send("1")

Jimmyalenius
Posts: 2
Joined: 31 Mar 2023, 12:27

Re: Combine function keys and numbers with a hotkey

Post by Jimmyalenius » 01 Apr 2023, 07:47

Hi! How do you differentiate between "send" and "sendEvent"?

User avatar
mikeyww
Posts: 26939
Joined: 09 Sep 2014, 18:38

Re: Combine function keys and numbers with a hotkey

Post by mikeyww » 01 Apr 2023, 08:01

You do it as shown in the scripts. SetKeyDelay does not apply to SendInput.

Explained: Send

Post Reply

Return to “Ask for Help (v2)”