Hello all -
I have been running Autohotkey 1.0.48.05 for a while, using it for key remappings in various programs and it's always been working great. I now have a more complex action I would like to perform.
In Photoshop (version CS5 in my case), ctrl-alt-Z is "step back history" (this is basically the "better undo" as ctrl-z only goes back up one step whereas navigating the history stack is unlimited). I am also using a special Photoshop script that makes small adjustments to what "step back history" does, and assigns it to ctrl-z. So in short : with my current setup, pressing ctrl-z performs undo exactly the way I need it.
However, in order to undo multiple times one has to press this undo keyboard shortcut repeatedly. This is fine in some cases but can be quite frustrating/cumbersome in others. I would like to use AHK to make this undo shortcut repeatable - that is to say, the ctrl-z action would repeat itself at a very short interval for as long as the ctrl-z shortcut is held down. Think of it like the way one can type a series of letters by simply holding down a key for a while in a word processor.
I would love to know how to script this behavior. Note that I don't have programming background.
Thanks !
Repeating undo in Photoshop Topic is solved
-
- Posts: 216
- Joined: 30 Jun 2016, 06:01
Re: Repeating undo in Photoshop Topic is solved
Code: Select all
$^z::
While (GetKeyState("CTRL", "p") && GetKeyState("z", "p"))
{
SendInput ^!z
Sleep 500
}
Return
Re: Repeating undo in Photoshop
Hi @neomulemi6 - this is great ! It works exactly as intended, and I got it to work for redo too. Very smooth.
Out of curiosity : what is the p key used for here ? Some kind of trick to make the script behave as intended maybe ?
Thanks you for your time, this is perfect.
P.O.
Out of curiosity : what is the p key used for here ? Some kind of trick to make the script behave as intended maybe ?
Thanks you for your time, this is perfect.
P.O.
-
- Posts: 216
- Joined: 30 Jun 2016, 06:01
Re: Repeating undo in Photoshop
The P retrieves the physical state of the key, so the function returns true if the CTRL and Z keys are held down. You can read more here: GetKeyState
Re: Repeating undo in Photoshop
Thank you for the details, I think I see what you mean. Appreciated !