Page 1 of 1

How to handle Key + Modifier

Posted: 01 Jan 2017, 23:33
by lidders
Hi, I've got a USB keyboard that sends some keypresses as a key + modifier, e.g Ctrl+F1. The scan function does not pick up the ctrl key modifier & just reports the F1 key as being pressed. Since I have another key that sends F1 I can't differentiate between the two key presses. Is there a way around this?

Thanks

Re: How to handle Key + Modifier

Posted: 02 Jan 2017, 08:10
by admin
No. Hidmacros don't support modifiers on input (triggering) side.

Re: How to handle Key + Modifier

Posted: 02 Jan 2017, 23:50
by lidders
Thanks for the quick reply. Is there a fundamental reason why you don't check? I was thinking of having a go at incorporating it into LuaMacros but I'd also need to add FSUIPC support back in & I'm not sure if I'm up to doing that. I'm more used to IOS programming & haven't done any Windows or Pascal stuff for a very long time.

Re: How to handle Key + Modifier

Posted: 03 Jan 2017, 08:53
by admin
Primary purpose of the tool is to have macros triggered by single key press. If you need more keys use additional keyboard. No need to use ctrl, alt, shift combinations as input. There are other tools for macro recording & shortcuts mapping available. And they use combinations because they cannot recognise multiple keyboards.
If your keyboard sends Ctrl+F1 for some regular key, disconnect this mapping and let HidMacros to recognise the key. If this is some special programmable key then you can't use it with Hidmacros.

Re: How to handle Key + Modifier

Posted: 07 Mar 2017, 13:04
by thjakob
Hello lidders,

Not shure if I`ve understood right - maby that will help.
My situation I managed this way: I collect nummeric-keys - but only whether ctr, alt nor shift is pressed.
So you can adapt the if clause... :-)
But - this works only, if your pad sends each key (luamacros must see the keys (eg. ctr down/up f1 down/up , maybe ctr down, f1 down/up, ctr up)

Salutation
Thomas

-------- get the state of ctr-key (once...)
---------- (do the same block for the other key (alt/shift))
if (button==17) then -- Ctrl
if (ctrlpressed==1) then
if (direction==0) then
ctrlpressed=0
print('Switch-Ctrl to '..ctrlpressed)
end
else
if (direction==1) then
ctrlpressed=1
print('Switch-Ctrl to '..ctrlpressed)
end
end
return
end

------ then (only for down-key-press) - check, whether ctr/etc. is still pressed..
------ in the rest you are probably not interessed (I do collect the key 0 to 9 in `sometext` ) and go on with that value when I press TAB...
if (direction==1) then
if((altpressed + ctrlpressed + shiftpressed) == 0) then
--- do whathever you like...
if (button>=48) then
if (button<=57) then
value=''..button-48
sometext = sometext..value
return
end
end
end
print('Button: '..button)
end