LuaMacros is AWESOME!
hope can add media control keys into the script(like NEXT ,PLAY/PUASE and so on)
thx in advance
Feature Request:Media control keys
Re: Feature Request:Media control keys
Thanks.
You mean add support for those keys to lmc_send_keys?
You mean add support for those keys to lmc_send_keys?
Petr Medek
LUAmacros author
LUAmacros author
Re: Feature Request:Media control keys
Hi,
im looking for media buttons too!
I even tried run some VBscript macros in HIDmacros, but somehow it is not working.
Another solution is programable custom keyboard, but it is quite time consuming.
im looking for media buttons too!
I even tried run some VBscript macros in HIDmacros, but somehow it is not working.
Another solution is programable custom keyboard, but it is quite time consuming.
Re: Feature Request:Media control keys
This is more of a reference for my future self than anything else.
Function is already there.
Mapping Media Keys Script.
codes for lmc_send_input(xxx, 0, 0) from table here MSDN Page
To work out the %DEVICE ID% run the following
the output will be something like below, The %DEVICE ID% is in Bold.
0:
Handle = 65603
Type = keyboard
SystemId = \\?\HID#VID_045E&PID_0745&MI_00#7&1CB458B1&0&0000#{884B96C3-56EF-11D1-BC8C-00A0C91405DD}
Name = <unassigned>
1:
Handle = 65601
Type = keyboard
SystemId = \\?\HID#VID_248A&PID_8566&MI_01#8&35124DA9&0&0000#{884B96C3-56EF-11D1-BC8C-00A0C91405DD}
Name = <unassigned>

Function is already there.
Mapping Media Keys Script.
Code: Select all
-- assign logical name to macro keyboard
lmc_assign_keyboard('MediaControl');
-- Hide Window to Tray
lmc.minimizeToTray = true
lmc_minimize()
clear()
-- define callback for whole device
lmc_set_handler('MediaControl',function(button, direction)
if (direction == 1) then return end -- ignore down
if (button == 37) then lmc_send_input(177, 0, 0) --Press Previous Track
elseif (button == 13) then lmc_send_input(179, 0, 0) -- Press Play/Pause
elseif (button == 39) then lmc_send_input(176, 0, 0) -- Press Next Track
elseif (button == 38) then lmc_send_input(175, 0, 0) --Press Volume Up
elseif (button == 40) then lmc_send_input(174, 0, 0) --Press Volume Down
else print('Not yet assigned: ' .. button)
end
end)
Of course you would want to swap out lmc_assign_keyboard('MediaControl') for lmc_device_set_name('MediaControl', '%DEVICE ID%').otta wrote: ↑17 Oct 2017, 17:46This table shows a list of hexdecimal values which representing certain keys. For example 1 = 0x30. If you are not familiar with hexdicmal values (like me) you can convert them to decimal values with the windows calculator (windows 10). Open it up, set it to "Programmer" and click on "HEX". Now you can type in the numbers and/or letters after the 0x. HEX 30 is 48 as decimal number. And the decimal number is the one you need for this function.
To work out the %DEVICE ID% run the following
Code: Select all
dev = lmc_get_devices()
for key,value in pairs(dev) do
print(key..':')
for key2,value2 in pairs(value) do print(' '..key2..' = '..value2) end
end
0:
Handle = 65603
Type = keyboard
SystemId = \\?\HID#VID_045E&PID_0745&MI_00#7&1CB458B1&0&0000#{884B96C3-56EF-11D1-BC8C-00A0C91405DD}
Name = <unassigned>
1:
Handle = 65601
Type = keyboard
SystemId = \\?\HID#VID_248A&PID_8566&MI_01#8&35124DA9&0&0000#{884B96C3-56EF-11D1-BC8C-00A0C91405DD}
Name = <unassigned>
Re: Feature Request:Media control keys
Just small comment: the second argument of lmc_device_set_name is actually regular expression that should match the "SystemId". So it can be any part of the Id making the match unique or even some more sophisticated regexp.
Petr Medek
LUAmacros author
LUAmacros author
Re: Feature Request:Media control keys
It's not that. Need INTERCEPTION of media keys. This script doesn't react on pressing eg VolumeUp.