In Photoshop I have 3 actions for my hotkey "g":
If I hold "space + g", zoom in and enable tool (zoom);
If tap "g", enable tool (smudge);
AND...
- If I tap "g" 2 times, open menu (Ctrl+Alt+F12). If tap 4 times, open another menu (Shift+Alt+F1).
NOTE: Need to be "~g" to work.
MY QUESTION:
How to group code 1 and 2 together with the third?
This way the third code don't works:
; CODES 1 AND 2 — WORKS:
g::
if !GetKeyState("Space","U")
{
Send, g ; CODE 2
return
} else {
Send, ^{Numpad0} ; CODE 1
Sleep 10
Send, z
return
}
; CODES 3 — WORKS:
~g::
if (A_PriorHotkey <> "~g" or A_TimeSincePriorHotkey > 400)
{
KeyWait, g
return
}
Send, % ["^!{F12}","+!{F1}"][(count >= 2 || !count) ? count := 1 : ++count]
return
; --------------------------------------------------
; Trying to put together...
; CODES 1 AND 2 + CODE 3 — (THIRD DON'T WORKS):
g::
if !GetKeyState("Space","U")
{
Send, g
return
} else {
Send, ^{Numpad0}
Sleep 10
Send, z
return
}
if (A_PriorHotkey <> "~g" or A_TimeSincePriorHotkey > 400)
{
KeyWait, g
return
}
Send, % ["^!{F12}","+!{F1}"][(count >= 2 || !count) ? count := 1 : ++count]
return
Answer
I do not know if the syntax of code below is correct because I'm newbie on AHK, but at least it works.
That works on Photoshop CC2015:
~g::
{
Sleep, 150
GetKeyState, state, g, U
IfEqual, state, U
{
if (A_PriorHotkey <> "~g" or A_TimeSincePriorHotkey > 400)
{
KeyWait, g
return
}
Send, % ["^!{F12}","+!{F1}"][(count >= 2 || !count) ? count := 1 : ++count]
return
}
if !GetKeyState("Space","U")
{
Send, g
return
}
else
{
Send, ^{Numpad0}
Sleep 10
Send, z
return
}
}
No comments:
Post a Comment