[PHOTOSHOP] ~ Shortcuts tend to lag or misbehave

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Steamy_Steve
Posts: 15
Joined: 26 Feb 2018, 05:57

[PHOTOSHOP] ~ Shortcuts tend to lag or misbehave

19 Mar 2018, 09:59

Hello.

I've encountered some problems while using AutHotkey to remap Photoshop's shortcuts.
I've written a small snippet for when a key needs to be held down, and it works wonderfully for all the other various graphic softwares I happen to use (including ZBrush):

Code: Select all

$d:: ; Color eyedropper
{
	send {LAlt down}
	KeyWait, d
	send {LAlt up}
	return
}
This snippet is reusable for any program that has keys that need to be held down and it's actually taken right from my Photoshop script.
My problem is that in Photoshop, sometimes, the command doesn't respond or gives me other results, as though keys weren't pressed fast enough or some were missed.
Sometimes I just have to wait an extra second to eventually get the tool I need.
It's very frustrating.
This very same template is also used in scripts for ZBrush and Corel Painter, so I feel entitled to expect it to work everywhere.

Could anybody help me, please? =0

AutoHotkey ver.: 1.1.24.00
User avatar
WalkerOfTheDay
Posts: 710
Joined: 24 Mar 2016, 03:01

Re: [PHOTOSHOP] ~ Shortcuts tend to lag or misbehave

19 Mar 2018, 10:09

As far as I know, the eyedropper is activated in Photoshop by pressing i, not d.

If you wanted to press i when pressing d you could simply do:

Code: Select all

#IfWinActive ahk_class Photoshop
d::i

User avatar
Steamy_Steve
Posts: 15
Joined: 26 Feb 2018, 05:57

Re: [PHOTOSHOP] ~ Shortcuts tend to lag or misbehave

19 Mar 2018, 11:40

WalkerOfTheDay wrote:As far as I know, the eyedropper is activated in Photoshop by pressing i, not d. [....]
If you hold the Alt key, the pointer temporarily changes into the eyedropper, same thing that happens when you hold down the Space Bar to temporarily switch to the "Panning Hand".

You clearly misread the snippet, what it does is: "when `d` is pressed, send the `Alt down` event, but wait for the `d` key to be released to send the `Alt up` event".

Here is the whole script:

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

^h::Suspend ; Suspend script
^j::ExitApp ; Close AutoHotkey script

e::Space ; Move canvas
; r::r ; Rotate canvas (default)
v::^+ ; Zoom in
c::^- ; Zoom out
$f::b ; Back to brush
$s::e ; Eraser

$d:: ; Color eyedropper
{
	send {LAlt down}
	KeyWait, d
	send {LAlt up}
	return
}

$z::send {LCtrl down}{LAlt down}z{LCtrl up}{LAlt up} ; Undo
$x::send {LCtrl down}{LShift down}z{LCtrl up}{LShift up} ; Redo

$q::send {LCtrl down}{LAlt down}{LShift down}n{LCtrl up}{LAlt up}{LShift up} ; New Normal Layer

$a:: ; Change Brush Size/Opacity
{
	send {LAlt down}{RButton down}
	KeyWait, a
	send {LAlt up}{RButton up}
	return
}
User avatar
WalkerOfTheDay
Posts: 710
Joined: 24 Mar 2016, 03:01

Re: [PHOTOSHOP] ~ Shortcuts tend to lag or misbehave

20 Mar 2018, 02:23

:) Sorry about that. I tested it in my (old 7.0) version, and in this one alt only activates the eye dropper when
using certain tools.

Like in brush mode, rectangle tool, but not when you are in the lasso tool or marquee tool for instance.
Could that be the reason it doesn't always work for you ?

Also, it might help to put the word Critical at the top of your script.
User avatar
Steamy_Steve
Posts: 15
Joined: 26 Feb 2018, 05:57

Re: [PHOTOSHOP] ~ Shortcuts tend to lag or misbehave

20 Mar 2018, 04:50

WalkerOfTheDay wrote::) Sorry about that. I tested it in my (old 7.0) version, and in this one alt only activates the eye dropper when
using certain tools.

Like in brush mode, rectangle tool, but not when you are in the lasso tool or marquee tool for instance.
Could that be the reason it doesn't always work for you ?

Also, it might help to put the word Critical at the top of your script.
Well, I use Photoshop primarily for digital painting (non professional...not yet) thus I'm 90% of the time in brush mode.
And there's always some kind of lag, between the key pressure and the pointer changing into the eyedropper tool.

What about the "Critical" key word? Care explaining? =o
User avatar
WalkerOfTheDay
Posts: 710
Joined: 24 Mar 2016, 03:01

Re: [PHOTOSHOP] ~ Shortcuts tend to lag or misbehave

20 Mar 2018, 05:29

Critical: (but you probably don't need it).
https://autohotkey.com/docs/commands/Critical.htm

This seems to work for me in Photoshop:

Code: Select all

#IfWinActive ahk_class Photoshop
$d:: ; Color eyedropper

send {LAlt down}
SLEEP, 1000
keywait, d, D
send {LAlt up}
return
User avatar
Steamy_Steve
Posts: 15
Joined: 26 Feb 2018, 05:57

Re: [PHOTOSHOP] ~ Shortcuts tend to lag or misbehave

20 Mar 2018, 05:39

Hmmm....1 second wait might be too long, sometimes it's just a very fast switching between brush and eyedropper, especially when I'm shading... =p
Maybe I'll just change it to the "i" shortcut. Not my ideal, since I'll have to tap back into the brush mode every time, but....if nothing better is available... =p
User avatar
Steamy_Steve
Posts: 15
Joined: 26 Feb 2018, 05:57

Re: [PHOTOSHOP] ~ Shortcuts tend to lag or misbehave

20 Mar 2018, 05:43

Out of curiosity I've just tested the Alt shortcut directly (by actually pressing the Alt key).
Apparently, the lag is present with AND without the script. It's just Photoshop....damn! >.<
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: [PHOTOSHOP] ~ Shortcuts tend to lag or misbehave

20 Mar 2018, 07:05

Code: Select all

d::Send, {Alt Down}
d Up::Send, {Alt Up}
User avatar
Steamy_Steve
Posts: 15
Joined: 26 Feb 2018, 05:57

Re: [PHOTOSHOP] ~ Shortcuts tend to lag or misbehave

20 Mar 2018, 07:35

swagfag wrote:

Code: Select all

d::Send, {Alt Down}
d Up::Send, {Alt Up}
Where does the difference lie? =o

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Dobbythenerd1 and 327 guests