Joined
·
12,992 Posts
Introduction (why I'm even writing this in the first place)
After the spacebar on my beloved Sidewinder X4 started sticking I had to get a new keyboard (lost my receipt, so no RMA). My budget was only around $50 though, so that ruled out a mechanical. Plus Tankguys is out of Ducky Browns, the only mech keyboard I was considering, and I'm not a fan of blues or blacks after having tried both.
I could get another Sidewinder X4, but the cheapest I could find it was $70 shipped and it wouldn't seem right paying $70 to replace a keyboard that should be working in the first place.
So I ended up getting an Apple Wired Keyboard, because everything else in the price bracket sucked, and scissor switches are a least a step up from the mushy rubber domes you get with generic low end keyboards, and Apple products are the same price online as in B&M, so I could save the shipping costs/time. I bought it for $56 after tax from Futureshop. Plus I love the minimalism.
The problem with getting an Apple keyboard is that its not designed to be used outside OSX, or even on any computer that's not a Mac. And like everything Apple does for Windows, support is borderline non-existent. If you aren't running Windows on a Mac then Boot Camp won't work, and if you can't run Boot Camp then you're left with generic keyboard drivers and non-functioning keys. But we can fix that.
Step 0
Plug the keyboard in. Windows will take a while to install the proper drivers and it should mostly work, aside from a few problems:
Step 1 - Install Autohotkey
Autohotkey is an open-source utility that lets you remap keys. Its not quite as elegant as SharpKey, as it required you to run your scripts in the background, but its much more powerful. Download AutoHotkey_L from here: http://www.autohotkey.com/download/ and install it. I recommend choosing the Ansi version when asked, since most of the scripts I've found don't support Unicode.
Step 2 - Download Keyboard Script
I've attached the script I'm using to remap the keys to my liking. It consists of 2 parts:
Download and extract the zip folder somewhere (I recommend your User folder), and run AutoHotKey.ahk to start the script. It should remap your keyboard as follows:
I highly encourage you to play around with it though. I created this setup to be generic, but I honetly don't expect anyone needs the scroll lock or pause keys. You can remap any key on your keyboard, and do more than simply swap buttons. Check out http://www.autohotkey.com/docs/Tutorial.htm for more of what you can do.
Step 3 (Optional): Start the script when Windows starts.
In order to do this you need to place a shortcut in the startup folder (C:\Users\\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup)
You can quickly open this by typing %AppData%\Microsoft\Windows\Start Menu\Programs\Startup into the search bar in the start menu or the explorer address bar. Create a shortcut to AutoHotkey.ahk in the folder like so: (protip: you can create a shortcut by holding ALT and dragging the file over)
And that's it. Not sure the eject key fix will work for any other model of Apple keyboard (mine is A1243 btw) but the hotkey remappings should work on any keyboard, so even if you don't have an Apple wired keyboard you could use this as a base for your own keyboard.
Also if you can get the Fn button working please please please share it with me. My OCD is driving me nuts.
Edit: uploaded the wrong file. whoops.
AppleWiredKeyboard_AHK.zip 11k .zip file
After the spacebar on my beloved Sidewinder X4 started sticking I had to get a new keyboard (lost my receipt, so no RMA). My budget was only around $50 though, so that ruled out a mechanical. Plus Tankguys is out of Ducky Browns, the only mech keyboard I was considering, and I'm not a fan of blues or blacks after having tried both.
I could get another Sidewinder X4, but the cheapest I could find it was $70 shipped and it wouldn't seem right paying $70 to replace a keyboard that should be working in the first place.
So I ended up getting an Apple Wired Keyboard, because everything else in the price bracket sucked, and scissor switches are a least a step up from the mushy rubber domes you get with generic low end keyboards, and Apple products are the same price online as in B&M, so I could save the shipping costs/time. I bought it for $56 after tax from Futureshop. Plus I love the minimalism.
The problem with getting an Apple keyboard is that its not designed to be used outside OSX, or even on any computer that's not a Mac. And like everything Apple does for Windows, support is borderline non-existent. If you aren't running Windows on a Mac then Boot Camp won't work, and if you can't run Boot Camp then you're left with generic keyboard drivers and non-functioning keys. But we can fix that.

Step 0
Plug the keyboard in. Windows will take a while to install the proper drivers and it should mostly work, aside from a few problems:
- The windows(command) and alt(option) keys are switched. This is because OSX uses command for standard hotkeys (eg. command+c, command+v)
- The eject button doesn't work
- The fn button doesn't work, and thus neither do any of the media controls
- F13-F19 don't do anything
Step 1 - Install Autohotkey
Autohotkey is an open-source utility that lets you remap keys. Its not quite as elegant as SharpKey, as it required you to run your scripts in the background, but its much more powerful. Download AutoHotkey_L from here: http://www.autohotkey.com/download/ and install it. I recommend choosing the Ansi version when asked, since most of the scripts I've found don't support Unicode.
Step 2 - Download Keyboard Script
I've attached the script I'm using to remap the keys to my liking. It consists of 2 parts:
The sole purpose of this script is to enable the eject key. The reason it doesn't work is because it actually has its own driver and shows up as a different HID device. It should also enable the Function key, but its not working on my machine. All it does is remap Eject to F20, and would remap Fn to F21 if it worked.
Code:
Code:
Code:
; Note: Go to line 63 to map your command to the Eject key.
;
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
Gui, Show, x0 y0 h0 w0, FnMapper
fnPressed := 0
HomePath=AutohotkeyRemoteControl.dll
hModule := DllCall("LoadLibrary", "str", HomePath)
OnMessage(0x00FF, "InputMsg")
EditUsage := 1
EditUsagePage := 12
HWND := WinExist("FnMapper")
nRC := DllCall("AutohotkeyRemoteControl\RegisterDevice", INT, EditUsage, INT, EditUsagePage, INT, HWND, "Cdecl UInt")
WinHide, FnMapper
InputMsg(wParam, lParam, msg, hwnd)
{
DeviceNr = -1
nRC := DllCall("AutohotkeyRemoteControl\GetWM_INPUTDataType", UINT, wParam, UINT, lParam, "INT *", DeviceNr, "Cdecl UInt")
if (errorlevel <> 0) || (nRC == 0xFFFFFFFF)
{
MsgBox GetWM_INPUTHIDData fehlgeschlagen. Errorcode: %errorlevel%
gosub cleanup
}
;Tooltip, %DeviceNr%
ifequal, nRC, 2
{
ProcessHIDData(wParam, lParam)
}
else
{
MsgBox, Error - no HID data
}
}
Return
ProcessHIDData(wParam, lParam)
{
; Make sure this variable retains its value outside this function
global fnPressed
global ejectPressed
DataSize = 5000
VarSetCapacity(RawData, %DataSize%, 0)
RawData = 1
nHandle := DllCall("AutohotkeyRemoteControl\GetWM_INPUTHIDData", UINT, wParam, UINT, lParam, "UINT *" , DataSize, "UINT", &RawData, "Cdecl UInt")
KeyStatus := NumGet(RawData, 1,"UChar")
Transform, FnValue, BitAnd, 16, KeyStatus
Transform, EjectValue, BitAnd, 8, KeyStatus
if (FnValue = 16) {
MsgBox function pressed
fnPressed := 1
SendInput {F21}
return
} else {
fnPressed := 0
}
if (EjectValue = 8) {
ejectPressed := 1
SendInput {F20}
} else {
ejectPressed := 0
}
} ; END: ProcessHIDData
; If there was an error retrieving the HID data, cleanup
cleanup:
DllCall("FreeLibrary", "UInt", hModule) ; It is best to unload the DLL after using it (or before the script exits).
ExitApp
This is the primary script that rebinds all of the keys to the more familiar windows ones.
Code:
Code:
Code:
#InstallKeybdHook
#SingleInstance force
SetTitleMatchMode 2
#Include Apple Wired Keyboard.ahk
SendMode Input
; --------------------------------------------------------------
; NOTES
; --------------------------------------------------------------
; ! = ALT
; ^ = CTRL
; + = SHIFT
; # = WIN
; media/function keys all mapped to the right option key
RAlt & F7::SendInput {Media_Prev}
RAlt & F8::SendInput {Media_Play_Pause}
RAlt & F9::SendInput {Media_Next}
RAlt & F10::SendInput {Volume_Mute}
RAlt & F11::SendInput {Volume_Down}
RAlt & F12::SendInput {Volume_Up}
; swap left command/windows key with left alt
LWin::LAlt
LAlt::LWin ; add a semicolon in front of this line if you want to disable the windows key
; Eject Key
F20::SendInput {Insert}
; F13-15, standard windows mapping
F13::SendInput {PrintScreen}
F14::SendInput {ScrollLock}
F15::SendInput {Pause}
;F16-19 custom app launchers, see http://www.autohotkey.com/docs/Tutorial.htm for usage info
F16::Run Notepad
F17::Run calc.exe
F18::Run http://www.overclock.net
F19::Run cmd
Download and extract the zip folder somewhere (I recommend your User folder), and run AutoHotKey.ahk to start the script. It should remap your keyboard as follows:

I highly encourage you to play around with it though. I created this setup to be generic, but I honetly don't expect anyone needs the scroll lock or pause keys. You can remap any key on your keyboard, and do more than simply swap buttons. Check out http://www.autohotkey.com/docs/Tutorial.htm for more of what you can do.
Step 3 (Optional): Start the script when Windows starts.
In order to do this you need to place a shortcut in the startup folder (C:\Users\\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup)
You can quickly open this by typing %AppData%\Microsoft\Windows\Start Menu\Programs\Startup into the search bar in the start menu or the explorer address bar. Create a shortcut to AutoHotkey.ahk in the folder like so: (protip: you can create a shortcut by holding ALT and dragging the file over)

And that's it. Not sure the eject key fix will work for any other model of Apple keyboard (mine is A1243 btw) but the hotkey remappings should work on any keyboard, so even if you don't have an Apple wired keyboard you could use this as a base for your own keyboard.
Also if you can get the Fn button working please please please share it with me. My OCD is driving me nuts.
Edit: uploaded the wrong file. whoops.

AppleWiredKeyboard_AHK.zip 11k .zip file
Attachments
-
10.8 KB Views: 1,450