Logitech G Keys Script

[code]function OnEvent(event, arg)
OutputLogMessage(“event = %s, arg = %s\n”, event, arg)
end

function OnEvent(event, gkey, family)
mkey = GetMKeyState()

-- commands on keyboard
if family == "kb" or family == "lhc" then
	if gkey == 1 and mkey == 1 then
		if event == "G_PRESSED" then
			PressKey(0x65);
		end
		if event == "G_RELEASED" then
			ReleaseKey(0x65);
		end
	end
	if gkey == 2 and mkey == 1 then
		if event == "G_PRESSED" then
			PressKey(0x66);
		end
		if event == "G_RELEASED" then
			ReleaseKey(0x66);
		end
	end
	if gkey == 3 and mkey == 1 then
		if event == "G_PRESSED" then
			PressKey(0x67);
		end
		if event == "G_RELEASED" then
			ReleaseKey(0x67);
		end
	end
	if gkey == 4 and mkey == 1 then
		if event == "G_PRESSED" then
			PressKey(0x68);
		end
		if event == "G_RELEASED" then
			ReleaseKey(0x68);
		end
	end
else -- commands on other devices
	if gkey == 6 then
		if event == "MOUSE_BUTTON_PRESSED" then
			OutputLogMessage("G6 pressed\n");
    				PressKey(0x64); 
		end
		if event == "MOUSE_BUTTON_RELEASED" then
			OutputLogMessage("G6 released\n");
    				ReleaseKey(0x64); 
		end
	end
end

end[/code]

Here you go.

what is this?

It’s a script for logitech g series keyboard and mice to use mumble without wasting a keyboard key.

Could you post, like…a video? I do what you suggest, but Mumble still won’t see the key

Edit: I got it to work, but it will not work in administrator mode, which means it won’t work when running SC
Edit: Admin mode isn’t necessary with the 1.3.0 snapshot

Wow, this is a keeper thanks :slight_smile:

I modified the script a bit and I have it working with my G930 headphones as well.

Mumble 1.2.9 works just fine.

Activates F13 thru F24. Turns out F24 uses a scan code that is out of sequence with F13-F23.

[code]function OnEvent(event, arg)
OutputLogMessage(“event = %s, arg = %s\n”, event, arg)
end

function OnEvent(event, gkey, family)
mkey = GetMKeyState()

– commands on keyboard
if family ~= “kb” and family ~= “lhc” then
if gkey == 1 and mkey == 1 then
if event == “G_PRESSED” then
PressKey(0x6d);
end
if event == “G_RELEASED” then
ReleaseKey(0x6d);
end
end
if gkey == 2 and mkey == 1 then
if event == “G_PRESSED” then
PressKey(0x6e);
end
if event == “G_RELEASED” then
ReleaseKey(0x6e);
end
end
if gkey == 3 and mkey == 1 then
if event == “G_PRESSED” then
PressKey(0x76);
end
if event == “G_RELEASED” then
ReleaseKey(0x76);
end
end
elseif family == “kb” then
if gkey == 1 and mkey == 1 then
if event == “G_PRESSED” then
PressKey(0x64);
end
if event == “G_RELEASED” then
ReleaseKey(0x64);
end
end
if gkey == 2 and mkey == 1 then
if event == “G_PRESSED” then
PressKey(0x65);
end
if event == “G_RELEASED” then
ReleaseKey(0x65);
end
end
if gkey == 3 and mkey == 1 then
if event == “G_PRESSED” then
PressKey(0x66);
end
if event == “G_RELEASED” then
ReleaseKey(0x66);
end
end
if gkey == 4 and mkey == 1 then
if event == “G_PRESSED” then
PressKey(0x67);
end
if event == “G_RELEASED” then
ReleaseKey(0x67);
end
end
if gkey == 5 and mkey == 1 then
if event == “G_PRESSED” then
PressKey(0x68);
end
if event == “G_RELEASED” then
ReleaseKey(0x68);
end
end
if gkey == 6 and mkey == 1 then
if event == “G_PRESSED” then
PressKey(0x69);
end
if event == “G_RELEASED” then
ReleaseKey(0x69);
end
end
if gkey == 7 and mkey == 1 then
if event == “G_PRESSED” then
PressKey(0x6a);
end
if event == “G_RELEASED” then
ReleaseKey(0x6a);
end
end
if gkey == 8 and mkey == 1 then
if event == “G_PRESSED” then
PressKey(0x6b);
end
if event == “G_RELEASED” then
ReleaseKey(0x6b);
end
end
if gkey == 9 and mkey == 1 then
if event == “G_PRESSED” then
PressKey(0x6c);
end
if event == “G_RELEASED” then
ReleaseKey(0x6c);
end
end
else
end
end[/code]