How to handle Key + Modifier

What features you would like to have in HIDmacros?
Post Reply
lidders
Posts: 3
Joined: 01 Jan 2017, 23:26

How to handle Key + Modifier

Post by lidders » 01 Jan 2017, 23:33

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

admin
Site Admin
Posts: 735
Joined: 01 Nov 2010, 13:00
Location: Prague, Czech republic
Contact:

Re: How to handle Key + Modifier

Post by admin » 02 Jan 2017, 08:10

No. Hidmacros don't support modifiers on input (triggering) side.
Petr Medek
LUAmacros author

lidders
Posts: 3
Joined: 01 Jan 2017, 23:26

Re: How to handle Key + Modifier

Post by lidders » 02 Jan 2017, 23:50

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.

admin
Site Admin
Posts: 735
Joined: 01 Nov 2010, 13:00
Location: Prague, Czech republic
Contact:

Re: How to handle Key + Modifier

Post by admin » 03 Jan 2017, 08:53

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.
Petr Medek
LUAmacros author

thjakob
Posts: 4
Joined: 03 Mar 2017, 21:05

Re: How to handle Key + Modifier

Post by thjakob » 07 Mar 2017, 13:04

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

Post Reply