AutoHotkey

AutoHotkey

<aside> 💡 Using AHK with After Effects to run shortcuts by double-tap or long-pressing

</aside>

;----------------------------------------------
#If WinActive("ahk_exe AfterFX.exe")
;----------------------------------------------

;----------------------------------------------
;Long-Press b: Set Work Area to Selected Layers
b::
KeyWait,b
if A_TimeSinceThisHotkey >= 300 ; in milliseconds.
{
send ^!b
}
else
send b
return
;----------------------------------------------
;Long-Press l: Split New Viewer and Toggle Lock
l::
KeyWait,l
if A_TimeSinceThisHotkey >= 300 ; in milliseconds.
{
send ^+!n
}
else
send l
return
;----------------------------------------------
;Long-Press n: New Null Object
n::
KeyWait,n
if A_TimeSinceThisHotkey >= 300 ; in milliseconds.
{
send !^+y
}
else
send n
return
;----------------------------------------------
;Long-Press h: Toggle Show Layer Controls
h::
KeyWait,h
if A_TimeSinceThisHotkey >= 300 ; in milliseconds.
{
send ^+h
}
else
send h
return
;----------------------------------------------
;Long-Press [: Trim Layer In Point at Current Time
[::
KeyWait,[
if A_TimeSinceThisHotkey >= 300 ; in milliseconds.
{
send ![
}
else
send [
return

;Long-Press ]: Trim Layer Out Point at Current Time
]::
KeyWait,]
if A_TimeSinceThisHotkey >= 300 ; in milliseconds.
{
send !]
}
else
send ]
return

;----------------------------------------------
;Long-Press p: Add Position Keyframe at Current Time
p::
KeyWait,p
if A_TimeSinceThisHotkey >= 300 ; in milliseconds.
{
send !+p
}
else
send p
return

;Long-Press s: Add Scale Keyframe at Current Time
s::
KeyWait,s
if  A_TimeSinceThisHotkey >= 300  ; in milliseconds.
{
send !+s
}
else
send s
return

;Long-Press r: Add Rotation Keyframe at Current Time
r::
KeyWait,r
if A_TimeSinceThisHotkey >= 300 ; in milliseconds.
{
send !+r
}
else
send r
return

;Long-Press t: Add Opacity Keyframe at Current Time
t::
KeyWait,t
if A_TimeSinceThisHotkey >= 300 ; in milliseconds.
{
send !+t
}
else
send t
return

;----------------------------------------------
;Double-Tap Esc: Send `
~$Esc:: 
if (A_PriorHotkey <> "~$Esc" or A_TimeSincePriorHotkey > 400) 
{ 
	KeyWait, Esc
	
	return 
} 
send ``
return
;----------------------------------------------

;----------------------------------------------
;Double-Tap Ctrl: Ram Preview

~Ctrl::  
if (A_PriorHotkey <> "~Ctrl" or A_TimeSincePriorHotkey > 400) 
{ 
	KeyWait, Ctrl
	return 
} 
send {Numpad0}
return
;----------------------------------------------
;Double-Tap Shift: Show/Hide Graph Editor
~LShift::  
if (A_PriorHotkey <> "~LShift" or A_TimeSincePriorHotkey > 400) 
{ 
	KeyWait, LShift
	return 
} 
send +{F3}
return

;----------------------------------------------
;Alt+8: Add Layer Marker
!8::
send {NumpadMult}
return
;----------------------------------------------

;----------------------------------------------
;Alt+Q: Shift Layer 1 Frame Earlier
;Shift+ Alt+Q: Shift Layer 10 Frame Earlier
!q::
send !{PgUp}
return

+!q::
send +!{PgUp}
return
;----------------------------------------------
;Alt+Q: Shift Layer 1 Frame Later
;Shift+Alt+Q: Shift Layer 10 Frame Later
!e::
send !{PgDn}
return

+!e::
send +!{PgDn}
return
;----------------------------------------------

;----------------------------------------------
;Alt+A: Shift Selected Keyframes 1 Frame Earlier
;Shift+Alt+A: Shift Selected Keyframes 10 Frame Earlier
!a::
send !{left}
return

+!a::
send +!{left}
return
;----------------------------------------------

;----------------------------------------------
;Alt+D: Shift Selected Keyframes 1 Frame Later
;Shift+Alt+D: Shift Selected Keyframes 10 Frame Later
!d::
send !{right}
return

+!d::
send +!{right}
return
;----------------------------------------------