Guide: Using the Apple Wired Keyboard in Windows 7 - - An Overclocking Community
Forum Jump: 

Guide: Using the Apple Wired Keyboard in Windows 7

Thread Tools
post #1 of 11 (permalink) Old 03-20-2012, 04:53 PM - Thread Starter
New to
nathris's Avatar
Join Date: Sep 2007
Location: Victoria, BC
Posts: 12,988
Rep: 1004 (Unique: 746)
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:
  • 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

We can fix everything but the Fn key. Maybe you'll have more luck than I did, but I couldn't get it to work.

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: 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:
Apple Wired Keyboard.ahk (Click to show)
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.
; 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
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)
        MsgBox, Error - no HID data

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}
  } 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
DllCall("FreeLibrary", "UInt", hModule)  ; It is best to unload the DLL after using it (or before the script exits).
AutoHotkey.ahk (Click to show)
This is the primary script that rebinds all of the keys to the more familiar windows ones.
#SingleInstance force
SetTitleMatchMode 2
#Include Apple Wired Keyboard.ahk
SendMode Input

; --------------------------------------------------------------
; --------------------------------------------------------------
; ! = 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
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 for usage info
F16::Run Notepad
F17::Run calc.exe
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 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. biggrin.gif 11k .zip file

Originally Posted by Miki
You have to work a lot harder at customizing an iPhone. I'm never going back. Ever.

nathris is offline  
Sponsored Links
post #2 of 11 (permalink) Old 03-20-2012, 08:07 PM
New to
Join Date: Jul 2009
Posts: 226
Rep: 5 (Unique: 5)
I just prefer using sharpkey since its simple easy & fast.

Current Setup
Intel Core i5 4570
8GB Crucial Ballistix Sports
Crucial M4 SSD
Corsair CX 600-M PSU
Asus Z87 A motherboard
Garyx24 is offline  
post #3 of 11 (permalink) Old 02-26-2013, 01:57 PM
New to
davidcncn's Avatar
Join Date: Feb 2013
Posts: 1
Rep: 0
Just read your post and used your solution and it worked. Thanks!!!
davidcncn is offline  
Sponsored Links
post #4 of 11 (permalink) Old 03-07-2013, 11:39 AM
New to
dannywaugh1's Avatar
Join Date: Mar 2013
Posts: 1
Rep: 0
everthing is working for me aprt from the insert key. in the script is says go to line 63 to set. what do i need to do? Sorry i must tell you im new to this.

i have model no A1243

dannywaugh1 is offline  
post #5 of 11 (permalink) Old 06-13-2013, 03:06 PM
New to
braindeadcrave's Avatar
Join Date: Jun 2013
Posts: 1
Rep: 0
Thank you worked like a charm P:
braindeadcrave is offline  
post #6 of 11 (permalink) Old 11-04-2013, 05:30 AM
New to
bcji's Avatar
Join Date: Sep 2013
Posts: 1
Rep: 0
I can't for the life of me get the media keys to work. Everything else okay! Any ideas please?
bcji is offline  
post #7 of 11 (permalink) Old 01-15-2014, 05:54 PM
New to
name's Avatar
Join Date: Jan 2014
Posts: 1
Rep: 0
This worked great for me, but the equals sign (=) on the number pad doesn't do anything. What can I add to the script?
name is offline  
post #8 of 11 (permalink) Old 04-07-2014, 04:30 PM
New to
SnoWHandS's Avatar
Join Date: Apr 2014
Posts: 1
Rep: 0
A little hard to understand at first but when I downloaded the zip you attached at the end of your post it all made sense, you're meant to open those .AHK files with the application you download from AutoHotKey's website. . . I was trying to compile them with that exe compiler they have on their download page which doesn't help tongue.gif

I also made my eject key a windows task manager key which will come in useful however I originally wanted to make it so that when I hold the eject key and a media key, the media function would be carried out, however that proved difficult as all the combinations I tried didn't work. If anyone has successfully done this themselves please do post a response

I also made my F19 key a Alt F4 key using the function F19:: Send !{F4}

Thanks for posting this it was a great help as Bootcamp is a typical apple application with no support...biggrin.gif
SnoWHandS is offline  
post #9 of 11 (permalink) Old 04-07-2014, 04:47 PM
New to
Jixr's Avatar
Join Date: Apr 2012
Posts: 5,400
Rep: 226 (Unique: 166)
guess you never heard of uawks? ( unoffical apple wireless keyboard support )
works with both wired and wireless apple keyboards
1 click download and done.

March, June, December 2014 Keyboard of the Month Winner
Jixr is offline  
post #10 of 11 (permalink) Old 08-24-2014, 10:16 AM
New to
xbipin's Avatar
Join Date: Aug 2014
Posts: 1
Rep: 0
with the newer apple boot camp drivers the fn keys work so can u provide the modified script using fn+f7-f12 ?
xbipin is offline  

Quick Reply

Register Now

In order to be able to post messages on the - An Overclocking Community forums, you must first register.
Please enter your desired user name, your email address and other required details in the form below.
User Name:
If you do not want to register, fill this field only and the name will be used as user name for your post.
Please enter a password for your user account. Note that passwords are case-sensitive.
Confirm Password:
Email Address
Please enter a valid email address for yourself.
Email Address:


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Show Printable Version Show Printable Version
Email this Page Email this Page

Forum Jump: 

Posting Rules  
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off