Repeating undo in Photoshop Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
Posts: 7
Joined: 26 May 2017, 19:08

Repeating undo in Photoshop

26 May 2017, 19:33

Hello all -

I have been running Autohotkey 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 !
Posts: 216
Joined: 30 Jun 2016, 06:01

Re: Repeating undo in Photoshop  Topic is solved

27 May 2017, 01:03

Code: Select all

While (GetKeyState("CTRL", "p") && GetKeyState("z", "p"))
	SendInput ^!z
	Sleep 500

Re: Repeating undo in Photoshop

27 May 2017, 13:12

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.

Posts: 216
Joined: 30 Jun 2016, 06:01

Re: Repeating undo in Photoshop

28 May 2017, 00:33

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

28 May 2017, 12:07

Thank you for the details, I think I see what you mean. Appreciated !

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], c7aesa7r, Google [Bot], hasantr, kunkel321, mikeyww and 43 guests