Feature Request:Media control keys

Announcements, questions
Post Reply
Buzzin
Posts: 8
Joined: 22 Dec 2015, 12:20

Feature Request:Media control keys

Post by Buzzin » 22 Dec 2015, 13:43

LuaMacros is AWESOME!
hope can add media control keys into the script(like NEXT ,PLAY/PUASE and so on)
thx in advance

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

Re: Feature Request:Media control keys

Post by admin » 27 Dec 2015, 22:25

Thanks.
You mean add support for those keys to lmc_send_keys?
Petr Medek
LUAmacros author

notalex
Posts: 2
Joined: 12 Jan 2017, 11:03

Re: Feature Request:Media control keys

Post by notalex » 12 Jan 2017, 11:08

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.

adsjc
Posts: 1
Joined: 06 Jan 2018, 02:53

Re: Feature Request:Media control keys

Post by adsjc » 06 Jan 2018, 03:44

This is more of a reference for my future self than anything else. :)
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) 
codes for lmc_send_input(xxx, 0, 0) from table here MSDN Page
otta wrote:
17 Oct 2017, 17:46
This 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.
Of course you would want to swap out lmc_assign_keyboard('MediaControl') for lmc_device_set_name('MediaControl', '%DEVICE ID%').

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 
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>

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

Re: Feature Request:Media control keys

Post by admin » 08 Jan 2018, 09:26

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

Dook
Posts: 1
Joined: 22 Feb 2017, 18:41

Re: Feature Request:Media control keys

Post by Dook » 14 Feb 2018, 20:03

It's not that. Need INTERCEPTION of media keys. This script doesn't react on pressing eg VolumeUp.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest