Tuesday, October 1, 2019

Lenovo Mini Wireless Keyboard N5901: Remap orange "My Computer" button


I have a Lenovo Mini Wireless Keyboard N5901 (a.k.a. Part No. 57Y6336) that I'm using with my HTPC running Windows 7.


The remote comes with an orange button in the top-left corner that by default, when pressed, opens the Windows "My Computer" window. I would like to remap / reprogram this button to act like the green "Windows Media Center" button instead on a Windows Media Center (WMC) remote; that is, open Windows Media Center if it isn't already open, or go to the WMC homepage if WMC is already open.


I've tried several keyboard-remapping utilities (as recommended in other, more general "how to remap keyboard key?" SuperUser.com questions) including SharpKeys, Key Mapper, and KeyTweak, with no luck so far. None of these utilities recognize the orange button -- they all do recognize that some key was pressed, but display a value for the key of "unsupported" or something similar.


I was able to use a utility called Keyboard Scan Code Generator to determine that a press of the orange button has a KeyData value of 16777217 (0x1000001), and a "Virtual Code" value of 182. (The other "media" buttons on the N5901 have the same KeyData value, but different Virtual Code values).


I'm not sure at this point where in Windows this keystroke is being interpreted as a command to open "My Computer." There is no special software / driver for this device; it worked out of the box with Windows 7, no special driver install necessary.


Is there any way to accomplish this?


Thanks in advance for any suggestions!


Answer



I think I have it figured out! The answer from kirk above got me pointed in the right direction.


I'm using this AutoHotKey script:


VKB6::  ;On a press of the Lenovo N5901 orange button:
if WinActive("Windows Media Center") ;Is WMC the current active window?
Send #!{Enter} ;Act like a "green button" press (go to WMC main menu)
else
run c:\windows\ehome\ehshell.exe ;Run/activate WMC
return

This script accomplishes the following on a press of the Lenovo N5901 remote's orange button:



  1. If Windows Media Center (WMC) is not running, run it.

  2. If WMC is running but is not the active window, activate it.

  3. If WMC is the active window, navigate to the WMC main menu. (As a bonus, a second press of the orange button will return to wherever you were before in WMC.)

  4. Suppress the default behavior of bringing up "My Computer" on a press of the orange button.


Essentially, this script turns the N5901's orange button into a standard Windows Media Center remote's "green button."


Credit goes to two sources for components of this script:


(1) The answer from kirk, above, for pointing me towards AutoHotKey in the first place, for the key code to capture a press of the orange button (VBK6), and the means to run/activate WMC (ehshell.exe).


(2) A post on the AutoHotKey forums by artificeren with an AutoHotKey script demonstrating how to conditionally select which action to perform depending on whether or not WMC is the current active window, and how to simulate a key press of the Windows Media Center remote "green button" (navigate to/from the Main Menu in WMC).


No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...