I wanted to share my solution to the following problem.
I own a Macbook with a bad keyboard, that randomly starts pressing the "arrow up" key.
Because this is an old laptop, I didn't want to invest any money on a new keyboard (which costs more than the laptop).
So I've decided to try and disable the "arrow up" key on the apple's keyboard whilst keeping the functionality on all other keyboards connected.
On OS X I've found a great program called keyremap4macbook, which allowed to map the key to "null" for a specific device. (This is acommplished with the <device_only> tag for their xmls).
But on Windows I couldn't find something equivalent.
I saw many people trying to use AutoHotKey and HIDMacros / AHKHID to accomplish similar needs, but I couldn't find a solution (perhaps HIDMacros does work, but on Windows 7 x64 it crashes, so I didn't make too much effort on that direction).
I've played a little with AHKHID and with the help of the AmourSpirit's comment, I was able to distinguish between the Apple's keyboard and the rest of the world (different number of key count).
But, as stated on main thread, it is not possible to block the key strokes with AHKHID. Trying to do the following:
up::
return
Which results in blocking the up key for all keyboards. Then I thought I might be able to tap on the key strokes with AHKHID, but I guess the mapping is down on a lower level, because the strokes don't get to the message loop.
So I've looked for a solution for the strokes to get to the script but not to the rest of the system. It first I thought about trying to block the up key from the message loop itself (with Hotkey remapping), this works only for the "next" stroke, which renders this solution useless.
So I looked up for another solution to remap the keys. I've came across SharpKeys. This program simply wraps up registry changes to remap specific keys. So I've mapped the up arrow to some unknown keycode (specifically to 0xE0_55)
Now I was able to use my script to tap on those strokes and simulate an up key click:
#Include %A_ScriptDir%\AHKHID.ahk
;Create GUI to receive messages
Gui, +LastFound
hGui := WinExist()
AHKHID_UseConstants()
LocalScript_Constants() {
Global ;To make the constants global
VK_SHIFT := 0x10
VK_CONTROL := 0x11
VK_ALT := 0x12
VK_LWIN := 0x5b
VK_RWIN := 0x5c
WM_KEYFIRST := 0x0100
WM_KEYDOWN := 0x0100
WM_KEYUP := 0x0101
WM_CHAR := 0x0102
WM_DEADCHAR := 0x0103
WM_SYSKEYDOWN := 0x0104
WM_SYSKEYUP := 0x0105
WM_SYSCHAR := 0x0106
WM_SYSDEADCHAR := 0x0107
g_shiftDown := ""
g_ctrlDown := ""
g_lwinDown := ""
g_rwinDown := ""
g_altDown := "" ; Alt behaves a little differently (also affects the msg)
}
LocalScript_Constants()
;Intercept WM_INPUT messages
WM_INPUT := 0xFF
OnMessage(WM_INPUT, "InputMsg")
;Register keyboard with RIDEV_INPUTSINK (so that data is received even in the background)
r := AHKHID_Register(1, 6, hGui, RIDEV_INPUTSINK)
Return
InputMsg(wParam, lParam) {
Local r, h
Critical ;Or otherwise you could get ERROR_INVALID_HANDLE
;Get device type
r := AHKHID_GetInputInfo(lParam, II_DEVTYPE)
;Check for error
If (r = RIM_TYPEKEYBOARD) {
h := AHKHID_GetInputInfo(lParam, II_DEVHANDLE)
iKeyCount := AHKHID_GetDevInfo(h, DI_KBD_NUMBEROFKEYSTOTAL, True)
vKey := AHKHID_GetInputInfo(lParam, II_KBD_VKEY)
msg := AHKHID_GetInputInfo(lParam, II_KBD_MSG)
; OutputDebug %vKey%_%msg%
If (iKeyCount = -1) {
; OutputDebug Simulated key %vKey%_%msg%
Return
}
If (vKey = VK_SHIFT)
g_shiftDown := IsKeyDown(msg) ? "{Shift Down}" : ""
Else If (vKey = VK_CONTROL)
g_ctrlDown := IsKeyDown(msg) ? "{Ctrl Down}" : ""
Else If (vKey = VK_LWIN)
g_lwinDown := IsKeyDown(msg) ? "{LWin Down}" : ""
Else If (vKey = VK_RWIN)
g_rwinDown := IsKeyDown(msg) ? "{RWin Down}" : ""
Else If (vKey = VK_ALT)
g_altDown := IsKeyDown(msg) ? "{Alt Down}" : ""
Else If (iKeycount > 0 && iKeyCount ^= 265) {
; Remaps broken keys back to real keys
downLabel := IsKeyDown(msg) ? "DOWN" : "UP"
sLabel := "NOT_APPLE_" vKey "_" downLabel
; OutputDebug %sLabel%
If IsLabel(sLabel) {
Gosub, %sLabel%
}
}
Else {
; OutputDebug An apple key: %vKey%_%msg%
}
}
}
NOT_APPLE_255_DOWN:
; OutputDebug %g_lwinDown%%g_rwinDown%%g_shiftDown%%g_ctrlDown%%g_altDown%{Up Down}
SendInput, %g_lwinDown%%g_rwinDown%%g_shiftDown%%g_ctrlDown%%g_altDown%{Up Down}
Return
NOT_APPLE_255_UP:
SendInput {Up Up}
Return
IsKeyDown(msg) {
Global
Return msg = WM_KEYDOWN || msg = WM_SYSKEYDOWN
}
This solution works. The page is no longer scrolling spontaneously up. 
Note that I had to simulate the modifier key strokes, because programs did not catch them with the simulated key (Most probably is because the combination they actually get is: "Shift Down, Unknown Key Down, Up Key Down" and they don't handle it well)
I hope this helps anyone.
Enjoy.
Edit:
Fixed a little bug with alt (didn't realize holding alt makes WM_SYSKEYDOWN messages instead of WM_KEYDOWN)