Additional keypad recommendations for more buttons? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
autopuff
Posts: 16
Joined: 29 Jun 2017, 18:55

Additional keypad recommendations for more buttons?

20 Nov 2017, 02:40

AHK is so useful that I almost used up all my keys on the keyboard. Instead of applying combinations of keys, I kinda want to buy an additional keypad/gameboard for more keys to use. I intended to buy the Logitech G13 gameboard but found out several posts saying that assigning AHK script to that device is not that easy. Thus, does anyone have any recommendation on devices that can provide additional keys for AHK to use? Thank you very much!
User avatar
boiler
Posts: 16902
Joined: 21 Dec 2014, 02:44

Re: Additional keypad recommendations for more buttons?

20 Nov 2017, 09:31

If you get a programmable keypad like the ones offered here, you can have them send some combination of keys that you would not otherwise use such as Shift+Control+Win+a, and then your AHK can set up +^#a as a hotkey and act whenever that specific key is pressed. I have not done that with these keypads, but I have implemented it foot pedals, and it's the same approach.
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: Additional keypad recommendations for more buttons?

20 Nov 2017, 11:46

By default, AHK cannot distinguish between different keyboards, so if you declare a hotkey to F1, it will trigger if you press F1 on any keyboard.
G13 keys are not normal windows keys. You would either need to implement something like RawInput, or remap the G13 using the provided software to keys that AHK can recognize.

If you wish to distinguish between devices AND you need to block the original function (eg you need to remap F1 on keyboard B to do something, but you do not want the OS to react to the press of F1), then you have VERY limited options.
EITHER you need a very technically complex combination of RawInput and Low-level hooks
OR use the Interception driver

I am soon to be releasing a new version of UCR (See signature) which should allow you to make blocking, per-device bindings to keys
(TL/DR: Soon, I should have software to do this, but with a normal keyboard, NOT with a G13)
It is worth noting, however, that I do own a G13, so at some point in the future, I may work out how to do this with a G13
User avatar
boiler
Posts: 16902
Joined: 21 Dec 2014, 02:44

Re: Additional keypad recommendations for more buttons?

20 Nov 2017, 12:06

To be clear and to differentiate the approach used with the programmable keypads I was suggesting from the issues evilC is pointing out, you don't have to worry about it not being differentiated from your normal keyboard because you will use it to send a combination of keystrokes (with one button press) that you wouldn't otherwise be sending. They have a programmable memory that will send to your computer any combination of keystrokes you want. So you don't have to differentiate from your keyboard, you just have it send combinations of keys that your script will recognize. So by pressing one key on that keyboard, the computer thinks it received +^#a, and you can act on that.
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: Additional keypad recommendations for more buttons?

20 Nov 2017, 14:00

@boiler it depends.
If he is using it for a game that has bindings to CTRL, ALT and Shift, then that precludes the use of any modifiers.
Also, many games will ignore modifier state, so using a hotkey for CTRL+SHIFT+W is still probably going to move the character forward.
User avatar
boiler
Posts: 16902
Joined: 21 Dec 2014, 02:44

Re: Additional keypad recommendations for more buttons?

20 Nov 2017, 14:03

evilC wrote:@boiler it depends.
If he is using it for a game that has bindings to CTRL, ALT and Shift, then that precludes the use of any modifiers.
Also, many games will ignore modifier state, so using a hotkey for CTRL+SHIFT+W is still probably going to move the character forward.
I see. OK. I use this approach with foot pedals and other software, but I don't use it for games.
autopuff
Posts: 16
Joined: 29 Jun 2017, 18:55

Re: Additional keypad recommendations for more buttons?

20 Nov 2017, 15:49

@evilC @boiler
I don't use that for gaming either. I'm using a laptop so sometimes I just want extended keys to push while laying back in my chair rather than reach to all the function keys on the top of the keyboard.
A keypad with keys that can be recognized as being different from the normal keyboard is the best. But if it's very hard to accomplish, then I don't mind buying a keypad that just "remaps" the keys from the normal keyboard.
Btw, does the "remap" mean something like if the keypad has a Q1 key, the computer cannot really recognize it as Q1 but I can still assign, like F7 from the normal keyboard/combination of keys, like ctrl+A, to Q1? If so, can G13/Razer Nostromo/X-keys® Programmable Keypads do that?
autopuff
Posts: 16
Joined: 29 Jun 2017, 18:55

Re: Additional keypad recommendations for more buttons?

20 Nov 2017, 16:06

evilC wrote:@boiler it depends.
If he is using it for a game that has bindings to CTRL, ALT and Shift, then that precludes the use of any modifiers.
Also, many games will ignore modifier state, so using a hotkey for CTRL+SHIFT+W is still probably going to move the character forward.
Sorry I haven't stated my condition more clearly. I'm not using it for a game, and I mostly work with excel and ImageJ.
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: Additional keypad recommendations for more buttons?

20 Nov 2017, 16:21

I think I understand you.
A G13 for example has buttons labelled like G1-G20
Without the logitech software running, the device is effectively not a keyboard, it is a custom "HID" device that does nothing.
The logitech software allows you to map normal keyboard keys (or sequences) to those buttons, and you could bind AHK scripts to the normal keyboard key sequences that it outputs (You may have to do as boiler says and add modifiers to make them not interfere with normal usage of the PC).
Annoyingly, at least with the logitech software anyway, it does not let you bind the G keys to F13-F24 (Which would be ideal as your keyboard will not have those, so it could not possibly interfere)
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: Additional keypad recommendations for more buttons?

20 Nov 2017, 16:33

AHA! I stand corrected, you CAN make Logitech Gaming Software send F13-F24

Create an AHK script:

Code: Select all

SetKeyDelay, 50, 50

F1::
	Sleep 2000
	Send {F24}
	return
Double click the option in LGS to create a new binding, then change to a different window.
Hit F1, then within 2 seconds, click the LGS window.
The AHK script sends F24 and LGS binds to it. You can now get the device to send F24 in response to one of it's buttons.

You can then write an AHK script to do something in response to F24 F24::msgbox, safe in the knowledge that it should not interfere with anything :)
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: Additional keypad recommendations for more buttons?  Topic is solved

20 Nov 2017, 16:53

Hehe, even better...

Open LGS, position your mouse over the + mark by the "Commands" panel on the left, then hit F1.
It makes the first binding, then you click OK yourself and it remembers the position of the OK button and does the remaining 11 binds for you.

You can then just drag keys F13-F12 to any of the buttons of your device to assign them.

Code: Select all

#NoEnv
#Singleinstance, Force
CoordMode, Mouse, Screen
SetKeyDelay, 50, 50

OKLocated := 0

F1::
	MouseGetPos, x1, y1
	Loop 12 {
		MouseMove, x1, y1
		Click
		num := A_Index + 12
		Sleep 250
		Send % "{F" num "}"
		if (OKLocated){
			MouseClick, Left, x2, y2
		} else {
			; Wait for user to click OK
			KeyWait, LButton, D
			KeyWait, LButton
			; Record coords
			MouseGetPos, x2, y2
			OKLocated := 1
		}
	}
	return
Image
autopuff
Posts: 16
Joined: 29 Jun 2017, 18:55

Re: Additional keypad recommendations for more buttons?

20 Nov 2017, 18:44

evilC wrote:Hehe, even better...

Open LGS, position your mouse over the + mark by the "Commands" panel on the left, then hit F1.
It makes the first binding, then you click OK yourself and it remembers the position of the OK button and does the remaining 11 binds for you.

You can then just drag keys F13-F12 to any of the buttons of your device to assign them.

Code: Select all

#NoEnv
#Singleinstance, Force
CoordMode, Mouse, Screen
SetKeyDelay, 50, 50

OKLocated := 0

F1::
	MouseGetPos, x1, y1
	Loop 12 {
		MouseMove, x1, y1
		Click
		num := A_Index + 12
		Sleep 250
		Send % "{F" num "}"
		if (OKLocated){
			MouseClick, Left, x2, y2
		} else {
			; Wait for user to click OK
			KeyWait, LButton, D
			KeyWait, LButton
			; Record coords
			MouseGetPos, x2, y2
			OKLocated := 1
		}
	}
	return
Image
Wow, this seems legit. The same process should also work for G13 right?
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: Additional keypad recommendations for more buttons?

21 Nov 2017, 13:24

Should do. I am in the process of moving and my G13 is packed away, but I am pretty certain that the G13 uses the same LGS software as G-series mice.
I posted this on Reddit and people have confirmed that the same technique also works for the Razer software, so take your pick of devices.
If not using it for gaming, the Razer Nostromo may be better, as the thumbstick is a Dpad, which would be more useful to you than an analog thumbstick like the F13 has.

However, I do not know how convenient it would be in the Razer software, and whether you could do like I did with LGS and pre-populate the extra keys quickly.
autopuff
Posts: 16
Joined: 29 Jun 2017, 18:55

Re: Additional keypad recommendations for more buttons?

16 Dec 2017, 01:05

evilC wrote:Should do. I am in the process of moving and my G13 is packed away, but I am pretty certain that the G13 uses the same LGS software as G-series mice.
I posted this on Reddit and people have confirmed that the same technique also works for the Razer software, so take your pick of devices.
If not using it for gaming, the Razer Nostromo may be better, as the thumbstick is a Dpad, which would be more useful to you than an analog thumbstick like the F13 has.

However, I do not know how convenient it would be in the Razer software, and whether you could do like I did with LGS and pre-populate the extra keys quickly.
Your code doesn't work for me, but I semi-manually add those keys to my G13 and it works pretty good so far. Thank you very much!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Descolada, hiahkforum, jchestnut, mcd, Sem552, ShatterCoder and 110 guests