Changing photoshop hardcoded shortcut keys

Tired of the hardcoded shortcut keys in photoshop? Want to change the TAB key into something else? And what the hell is up with not being able to bind stuff to single letter shortcuts?

No matter. Go download the program Autohotkeys, it’s free and awesome.
Autohotkey allows you to trap keys before a program gets control and send some other keycode intirely and throw away the trapped keycode.

This means that you can now just bind commands in photoshop to whatever random keycode and then setup autohotkey to watch for say “w” and translate that into the keycode photoshop expects.

Not clear enough yet? Ok here’s a sequence of what would happen. In this example want the curves dialog shortcut to just be “c” which photoshop won’t allow.

Autohotkey is watching for the key C to be pressed.
I press C.
Autohotkey catches that I pressed C and discards that, so photoshop doensn’t know C has been pressed.
Autohotkey sends control+m
Photoshop brings up the curves dialog because it sees control+m.

Here’s a simple code snippet you can change around to map out shortcut keys in photoshop.

#ifWinActive ahk_class Photoshop
{
NumLock::
{
Send {F11}
Sleep, 100
return
}
}

Let’s look at what’s going on here:

#ifWinActive ahk_class Photoshop

This is a section; So this only gets triggered when photoshop has the focus.

NumLock::

We watch for and catch the numlock key. Look in AHK helpfile for a table of keycodes.

We enter another section that only gets triggered when AHK sees that numlock has been pressed.

Send {F11}

AHK sends out the F11 key that you bind to whatever you want to happen in photoshop when you press the numlock key.

Sleep, 100

AHK pauses for 100ms just to give the program some time to react and returns.

Holding down keys

Say you want to simulate that you hold down alt+shift+m. This is done by by putting the keys you want to press and hold within brackets using the Send command.

Here’s a Send command that presses and holds down control+shift while pressing the M key:

Send {Control down}{Shift down}m{Shift up}{Control up}

The {Keycode up}{Keycode down} trick works for all keys.

Creating toggle dialogs (you will love this)

A toggle dialog is a popup window like the curves dialog where the same key that brings up the dialog will also close the dialog. Using a toggle dialog speeds up your workflow a lot. So say you bind the C key to bring up curves, adjust the curves and hit C again to accept the changes and close the curves dialog. So instead of pressing control+m, adjust, press enter you just to “C, adjust curves, C” done. MUCH faster.

First create a watch for whatever key you want and bind it to a command that brings up a dialog window.

Now look at this dialog window and notice the titlebar text. For example the curves dialog will say simply “Curves”

Here’s the code to handle a dialog toggle. Just change the “#IfWinActive, Curves” to whatever the dialog titlebar says. And also change the “c::” part to the same key that brings up the dialog.

#IfWinActive, Curves
{
c::
{
Send, {ENTER}
Sleep, 100
return
}
}

What’s going on here then? Since the curves dialog is now on top of photoshop, it no longer has the focus, so the watch that brings up curves won’t trigger, because these are all inside “#ifWinActive ahk_class Photoshop” sections that only triggers when photoshop has the front focus. So now the “#IfWinActive, Curves” section will trigger instead; see that you pressed C, and send ENTER instead which will close the curves dialog window.

Holding down a mouse button while pressing keys

Special shortcuts in programs like photoshop or corel painter allows you to hold down a key combination and click and drag to rotate the canvas or resize your brushes.

Let’s see how we can emulate this and even make it better:

#ifWinActive ahk_class Photoshop
{
s::
{
send {alt down}
mouseclick, right,,, 1, 0, d
Loop
{
sleep, 10
GetKeyState, state, s, p
if state = u
break
}
mouseclick, right,,, 1, 0, U
send {alt up}
return
}
}

This script presses the ALT key while holding down the right mouse button so all you need to do is press the shortcut key (S) and move the mouse, no need to click and drag.

To change the shortcut that is watched, simply change the key (S in this example) and also change the S in the line that says “GetKeyState, state, s, p ”

You can add other modifiers, for example press control+alt, just change the 2 Send lines or chage the right mouse key to the left mouse key as in the example below that presses control+alt while holding down the right mousebutton:

#ifWinActive ahk_class Photoshop
{
w::
{
send {alt down}+{Control down}
mouseclick, left,,, 1, 0, d
Loop
{
sleep, 10
GetKeyState, state, w, p
if state = u
break
}
mouseclick, left,,, 1, 0, U
send {Control up}+{alt up}
return
}
}

See also: Photoshop and AutoHotKey the Perfect Pair

You must be logged in to post a comment.