Help: Media control keys stopped working

Announcements, questions
Post Reply
Posts: 2
Joined: 15 Feb 2021, 07:16

Help: Media control keys stopped working

Post by alonh » 16 Aug 2022, 18:24

I’ve been using Lua macros for quite some time now and I’m very happy with it.
I have a separate numeric keypad which I use with media macros.
Last week suddenly the keys that control play, pause and next/previous track stopped working, the rest still works fine.
I tried disconnecting and connecting it again, reinstalling drivers, changing the buttons in the keypad and even assigning these buttons to another keyboard but nothing works.
I also tried connecting and old PS2 keyboard that has physical media buttons and they work just fine.
I don’t have any error, it is just doesn't send the command, how can I debug this?
This is the code I’m using:

Code: Select all

-- assign logical name to macro keyboard
-- lmc_assign_keyboard('MediaControl')
lmc_device_set_name('MediaControl', 'CDBE9F0')

-- Hide Window to Tray
lmc.minimizeToTray = true

-- define callback for whole device
lmc_set_handler('MediaControl',function(button, direction)
  if (direction == 1) then return end  -- ignore down
  if (button == 100) then lmc_spawn("calc")
  elseif (button == 101) then lmc_spawn("C:\\Windows\\System32\\SnippingTool.exe")
  elseif (button == 105) then lmc_send_input(179, 0, 0) -- Press Play/Pause
  elseif (button == 104) then lmc_send_input(176, 0, 0) -- Press Next Track
  elseif (button == 103) then lmc_send_input(177, 0, 0) --Press Previous Track
  elseif (button == 106) then lmc_send_input(173, 0, 0) -- Press Volume Mute/Unmute
  elseif (button == 107) then lmc_send_input(175, 0, 0) --Press Volume Up
  elseif (button == 109) then lmc_send_input(174, 0, 0) --Press Volume Down
  elseif (button == 110) then
  else print('Not yet assigned: ' .. button)
Got it from this post:

Any help will be much appreciated, thank you.

Post Reply