Tag Archives: volume

Hardware Key Remapping for Photoshop (Surface Pro 1) with AutoHotKey

So I really enjoy my Surface, but wasn’t happy how it doesn’t come with hardware key remapping.
I remapped the volume keys, the windows key and the stylus button (set to “Right Mouse Button”) to be useful in Photoshop.
The remapping together with the art dock 2.0 makes my Surface Pro no longer feel inferior to Wacom tablets besides the precision problem.

Functions in Photoshop (tested in CS6 with Surface Pro 1)

Pressed Key Remapped Key Function inside PS
Right Click (Pen Button) Alt Down Color Picker (left click to pick color or right click again for Alt Up)
Volume Up ] Increase Brush Size
Volume Down [ Decrease Brush Size
Windows Key Ctrl + Alt + Z Undo
Double Right Click toggle b and e switches between Eraser and Brush Tool
Right Click + Volume Up Ctrl + = Zoom in
Right Click + Volume Down Ctrl + – Zoom out
Double Volume Up not mapped yet, suggestions?
Double Volume Down not mapped yet, suggestions?

So what do you need?
Software: http://www.autohotkey.com/
Keyboard set to US keyboard layout(!)
and my .ahk file (which is really messy because I coded it with my on-screen touch keyboard in bed, sorry 🙂
Paste it in an empty text file and save it as anynameyoulike.ahk.
Double click to run it.

;#InstallKeybdHook

isAltUp = 1
isBrushToolActive = 1

#IfWinActive, ahk_class Photoshop
Rbutton::
if (A_PriorHotkey <> "Rbutton" or A_TimeSincePriorHotkey > 400)
{
; Too much time between presses, so this isn't a double-press.

GetKeyState, state, LAlt
if state = D
{
SendInput {LAlt up}
isAltUp = 1
return
}

else if(isAltUp == 1){
SendInput {LAlt down}
isAltUp = 0
return
} else {
SendInput b
return
}

KeyWait, RButton
return
}
SendInput {LAlt up}
isAltUp = 1
if(isBrushToolActive == 1)
{
SendInput {e}
isBrushToolActive = 0
return
}
else {
SendInput {b}
isBrushToolActive = 1
;MsgBox You double-pressed the right control key.
return
}
#IfWinActive

#IfWinActive, ahk_class Photoshop
~LButton::
GetKeyState, state, LAlt
if state = D
SendInput LButton
SendInput {LAlt up}
isAltUp = 1
return
#IfWinActive

#IfWinActive, ahk_class Photoshop

SC130::
GetKeyState, state, LAlt
if state = D
{
SendInput {Ctrl down}
SendInput {=}
SendInput {Ctrl up}
SendInput {LAlt up}
isAltUp = 1
return
}
else {
SendInput {]}
return
}

SC12E::
GetKeyState, state, LAlt
if state = D
{
SendInput {Ctrl down}
SendInput {-}
SendInput {Ctrl up}
SendInput {LAlt up}
isAltUp = 1
return
}
else {
SendInput {[}
return
}

SC15B::^!z
#IfWinActive