Skip to content

Instantly share code, notes, and snippets.

@littletsu
Created September 15, 2024 22:49
Show Gist options
  • Save littletsu/8acc20bba1a0c333ff8460852a5ac542 to your computer and use it in GitHub Desktop.
Save littletsu/8acc20bba1a0c333ff8460852a5ac542 to your computer and use it in GitHub Desktop.
DaVinci Resolve transform keyframe & adjustment clip keyboard shortcuts with AutoHotKey
#Include export.ahk
#Include %A_ScriptDir%
#Include graphics.ahk
CoordMode, Mouse
global timeout := 10
global oGraphicSearch := new graphicsearch()
global g_clipDeAjuste := clipDeAjuste
global g_efectos := efectos
global g_selectedSearchBar := selectedSearchBar
global g_searchBar := searchBar
global g_video := video
global g_anyKf := anykf
DragClip(xpos, ypos) {
resultObj := ographicsearch.search(g_clipDeAjuste)
if (resultObj) {
X := resultObj.1.x, Y := resultObj.1.y, Comment := resultObj.1.id
MouseMove, %X%, %Y%
SetDefaultMouseSpeed, 2
MouseClickDrag, left, %X%, %Y%, %xpos%, %ypos%
return "drag"
}
return "no"
}
ClickEffects(tries, xpos, ypos) {
if(tries > 3) {
return "no"
}
t1 := A_TickCount, aX := aY := X := Y := ""
drag := DragClip(xpos, ypos)
if(drag = "no") {
aresultObj := ographicsearch.search(g_efectos)
if (aresultObj) {
ographicsearch.resultSort(aresultObj)
aX := aresultObj.1.x, aY := aresultObj.1.y, aComment := aresultObj.1.id
Click, %aX%, %aY%
Sleep, %timeout%
}
} else {
return drag
}
drag := DragClip(xpos, ypos)
if(drag = "no") {
aresultObj := ographicsearch.search(g_selectedSearchBar)
searchX := 0
searchY := 0
if (aresultObj) {
aX := aresultObj.1.x, aY := aresultObj.1.y, aComment := aresultObj.1.id
searchX := aX
searchY := aY
Click, %aX%, %aY%
Sleep, %timeout%
} else {
aresultObj := ographicsearch.search(g_searchBar)
leftmostKfY := 0
leftmostKfX := 9999
for i,v in aresultObj {
kY := aresultObj[i].y
kX := aresultObj[i].x
if(kX < leftmostKfX) {
leftmostKfY := kY
leftmostKfX := kX
}
}
if (leftmostKfX != 9999) {
searchX := leftmostKfX
searchY := leftmostKfY
Click, %leftmostKfX%, %leftmostKfY%
Sleep, %timeout%
}
}
SetKeyDelay, 0
Send Clip de ajuste
Sleep, %timeout%
drag := ClickEffects(tries + 1, xpos, ypos)
if(drag = "drag") {
Sleep, %timeout%
Click, %searchX%, %searchY%
Sleep, %timeout%
Click, %xpos%, %ypos%
}
}
return drag
}
#IfWinActive ahk_exe Resolve.exe
^p::
SetDefaultMouseSpeed, 0
MouseGetPos, xpos, ypos
ClickEffects(0, xpos, ypos)
return
^j::
SetDefaultMouseSpeed, 0
MouseGetPos, xpos, ypos
t1 := A_TickCount, aX := aY := ""
aresultObj := ographicsearch.search(g_video)
if (aresultObj) {
aX := aresultObj.1.x, aY := aresultObj.1.y, aComment := aresultObj.1.id
Click, %aX%, %aY%
Sleep, %timeout%
}
resultObj := ographicsearch.search(g_anyKf)
topmostKfY := 9999
topmostKfX := 0
for i,v in resultObj {
kY := resultObj[i].y
if(kY < topmostKfY) {
topmostKfY := kY
topmostKfX := resultObj[i].x
}
}
if (topmostKfY != 9999) {
Click, %topmostKfX%, %topmostKfY%
Sleep, %timeout%
MouseMove, %xpos%, %ypos%
}
return
#IfWinActive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment