AHKHID - possible to trigger RawInput?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Stevie
Posts: 24
Joined: 15 Nov 2013, 19:32

AHKHID - possible to trigger RawInput?

Post by Stevie » 12 Jul 2017, 16:53

Hey all,

I captured some special keys (G-Keys) from my Logitech keyboard with AHKHID.
Is it now possible to trigger these keys like (fake code):

Code: Select all

SendInput, {G-Key12}
Or can I only assign commands to these G-Keys like (fake code):

Code: Select all

G-Key12::
SendInput, {SPACE}

Noesis
Posts: 301
Joined: 26 Apr 2014, 07:57

Re: AHKHID - possible to trigger RawInput?

Post by Noesis » 13 Jul 2017, 08:18

You can NOT send/trigger the g-key (i.e. first example), but you can have something happen when one is pressed. You can't really assign it like a hotkey as per your second example, but you could use a label or function instead of the hotkey, and from the code detecting it with ahkhid, call the label/function subroutine.

Keep in mind ahkhid doesn't block the "default" function of the key, this isn't a big deal assuming you are in fact getting the raw g-key. (i.e. you can't have something assigned to the g-key in LGS and expect this to work, as if you assign something to a g-key in LGS you won't be able to detect the raw g-key, you will actually be detecting LGS sending whatever it is mapped to.)

Stevie
Posts: 24
Joined: 15 Nov 2013, 19:32

Re: AHKHID - possible to trigger RawInput?

Post by Stevie » 13 Jul 2017, 17:19

Aha! I see, I was completely unaware of this. Well, I would love to be able to trigger the M-Switches (M1, M2, M3). They provide 3 layers of 18 G-Keys.
It would be handy to map these M-Switches to a mouse button, to quickly change the layer of the G-Keys. But I guess this function has been hardcoded in the keyboard and there's no way to get it.

Noesis
Posts: 301
Joined: 26 Apr 2014, 07:57

Re: AHKHID - possible to trigger RawInput?

Post by Noesis » 14 Jul 2017, 08:14

Yes it would be handy but alas not doable as far as I know. I'm not really sure when it comes to M-Switches, I don't have a Logitech keyboard, so don't have the M-Switches, but I do have a headset with g-keys (buttons) hence I know about the g-keys. I would like to do a similar thing but with a Razer gaming keypad that can switch modes, would be great to not have to use one of it's keys to do so and be able to use a mouse/joystick button instead, but nope.

One thing that may work is using the LUA scripting side of LGS, but I haven't looked into it enough to know for sure, and I suspect it probably can't be done, at least not unless you also have a Logitech mouse, which also uses LGS.

Stevie
Posts: 24
Joined: 15 Nov 2013, 19:32

Re: AHKHID - possible to trigger RawInput?

Post by Stevie » 14 Jul 2017, 08:22

I have looked into LUA, but Logitech limits the assignment of the M-Keys to the G-Keys. Which makes sense in some way, but you lose one or more G-Keys.
But I found a thread on a German Gaming Keyboard forum. Apparently a guy extended the LUA script and added many more possibilities.
I will check that out and report back if it does what I'm trying to do. It would be perfect to use CTRL to temporarily toggle from M1 to M2 for example.

Stevie
Posts: 24
Joined: 15 Nov 2013, 19:32

Re: AHKHID - possible to trigger RawInput?

Post by Stevie » 14 Jul 2017, 11:19

It worked!

First you need to "install" the G-max library, but this process is straight forward:

http://www.g15-applets.de/g-max--ultima ... t9653.html

And then you use this script here and put it in the LUA script page of the Logitech Gaming Software. When you press the right control key, the M-Switch will toggle to M2 and when you release it, it will
switch back to M1. Enjoy!

Code: Select all

------------->>> COPY FROM HERE
 ClearLog()
 ClearLCD()
 ----------------------------------------- SETUP -----------------------------------------------------------------------------------------------------------
 gL = { path = [[C:\G-Max\]] }         -- Edit your location of the G-AddOn Folder
 dofile(gL.path .. "gL.lua")
 -- Add Setup-Features here --->>>
 EnableModLocKeyEvents()
 ----------------------------------------- /SETUP -----------------------------------------------------------------------------------------------------------


 function gL.KeySetup() -------------------------------------------------------------------------- KEY-ASSIGNMENTS
       --EnablePrimaryMouseButtonEvents(true)

kb.rctrl.m0 = MSwitch
 end ---------------------------------------------------------------------------------------------------- /KEY-ASSIGNMENTS

-- User Functions

function MSwitch(event,arg,family,mstate)
   if event == "pressed" then
      SetMKeyState(2, "kb")

   elseif event == "released" then
      SetMKeyState(1, "kb")
   end
end

djgraver
Posts: 3
Joined: 04 Aug 2017, 10:53

Re: AHKHID - possible to trigger RawInput?

Post by djgraver » 15 Jan 2023, 17:05

Hi Steve! I'm looking for almost for same thing with Gkeys!
Only I want to link SetMkeyState to WinTitle in AHK, is it possible to achive ?
I can't find GMax, all links are dead :cry:


Post Reply

Return to “Ask for Help (v1)”