Code: Select all
#NoEnv
#IfWinActive, Adobe Premiere Pro 2021
#SingleInstance force
#WinActivateForce
#MaxHotkeysPerInterval 2000
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
Menu, Tray, Icon, imageres.dll, 82
SetWorkingDir, D:\@ Edição de Vídeo\AHS Working Dir\
#IfWinActive ahk_exe Adobe Premiere Pro.exe
~F14::
global VFXkey = "F14"
instantVFX("scale")
return
#IfWinActive ahk_exe Adobe Premiere Pro.exe
~F15::
global VFXkey = "F15"
instantVFX("anchor_point_vertical")
return
#IfWinActive ahk_exe Adobe Premiere Pro.exe
~F17::
global VFXkey = "F17"
instantVFX("rotation")
return
#IfWinActive ahk_exe Adobe Premiere Pro.exe
~F18::
global VFXkey = "F18"
instantVFX("anchor_point")
return
clickTransformIcon()
{
ControlGetPos, Xcorner, Ycorner, Width, Height, DroverLord - Window Class10, ahk_class Premiere Pro
MouseMove, Xcorner+99, Ycorner+99, 0
MouseClick, left
}
instantVFX(foobar)
{
dontrestart = 0
restartPoint:
blockinput, sendandMouse
blockinput, MouseMove
blockinput, on
Sendinput ^!+5
sleep 10
MouseGetPos Xbeginlol, Ybeginlol
global Xbegin = Xbeginlol
global Ybegin = Ybeginlol
ControlGetPos, Xcorner, Ycorner, Width, Height, DroverLord - Window Class10, ahk_class Premiere Pro
YY := Ycorner+99
XX := Xcorner+18
MouseMove, XX, YY, 0
sleep 10
PixelGetColor, colorr, XX, YY
if (colorr = "0x979797")
{
blockinput, Mouse
Click XX, YY
sleep 5
clickTransformIcon()
findVFX(foobar)
Return
}
else if (colorr = "0x7A7A7A")
{
blockinput, Mouse
sleep 5
clickTransformIcon()
findVFX(foobar)
;untwirled = 1
Return, untwirled
}
else if (colorr = "0x1D1D1D" || colorr = "0x232323")
{
Send ^p
sleep 10
Send ^p
resetFromAutoVFX()
If (dontrestart = 0)
{
dontrestart = 1
goto, restartPoint
}
Return reset
}
else
{
tooltip, %colorr% not expected
resetFromAutoVFX()
Return reset
}
}
Return
findVFX(foobar)
{
sleep 5
MouseGetPos xPos, yPos
/*
if foobar = "scale"
ImageSearch, FoundX, FoundY, xPos-90, yPos, xPos+800, yPos+500, %A_WorkingDir%\scale_D2021.png
else if foobar = "anchor_point"
ImageSearch, FoundX, FoundY, xPos-90, yPos, xPos+800, yPos+500, %A_WorkingDir%\anchor_point_D2021.png
*/
ImageSearch, FoundX, FoundY, xPos-90, yPos, xPos+800, yPos+900, %A_WorkingDir%\%foobar%_D2021.png
if ErrorLevel = 1
ImageSearch, FoundX, FoundY, xPos-30, yPos, xPos+1200, yPos+1200, *10 %A_WorkingDir%\%foobar%_D2021.png
if ErrorLevel = 2
{
msgbox,,, ERROR LEVEL 2`nCould not conduct the search,1
resetFromAutoVFX()
}
if ErrorLevel = 1
{
;msgbox, , , error level 1, .7
msgbox,,, ERROR LEVEL 1`n%foobar% could not be found on the screeen,1
resetFromAutoVFX()
}
else
{
MouseMove, FoundX, FoundY, 0
sleep 5
findHotText(foobar)
}
}
findHotText(foobar)
{
tooltip,
MouseGetPos, xxx, yyy
if (foobar = "scale" || foobar = "anchor_point" || foobar = "rotation")
{
PixelSearch, Px, Py, xxx+50, yyy+10, xxx+500, yyy+11, 0x3398EE, 30, Fast RGB
}
else if (foobar = "anchor_point_vertical")
{
ImageSearch, Px, Py, xxx+100, yyy, xxx+800, yyy+100, %A_WorkingDir%\anti-flicker-filter_000.png
}
if ErrorLevel
{
sleep 100
resetFromAutoVFX()
}
else
{
if (foobar <> "anchor_point_vertical")
{
MouseMove, Px+10, Py+5, 0
}
else if (foobar = "anchor_point_vertical")
{
MouseMove, Px+80, Py-20, 0
tooltip, where am I?
}
Click down left
GetKeyState, stateFirstCheck, %VFXkey% , "P"
if stateFirstCheck = U
{
Click up left
Sleep 10
if (foobar = "scale")
{
Send, 100
sleep 50
Send, {enter}
sleep 20
}
if (foobar = "rotation")
{
Send, 0
sleep 50
Send, {enter}
sleep 20
}
resetFromAutoVFX()
}
Loop
{
blockinput, off
blockinput, MouseMoveOff
tooltip,
sleep 15
GetKeyState, state, %VFXkey% , "P"
if state = U
{
Click up left
sleep 15
resetFromAutoVFX()
Return
}
}
}
}
resetFromAutoVFX()
{
global Xbegin
global Ybegin
MouseMove, Xbegin, Ybegin, 0
blockinput, off
blockinput, MouseMoveOff
}
My plan is to use Shift and %VFXkey% to activate each string of the instantVFX() function.
Basically what this script does is:
1. Get your XY position of your mouse (so that it can return to it original position at the end)
2. Find a particular window class in Premiere Pro (video editing software) to then find a particular parameter that I want to change, basically by moving the mouse to the value of the specified parameter. So when I press the assigned keystroke, it will click and hold the left mouse button until I release the key.
I think this is able to happen, because at the end of the function exists two GetKeyState that identifies when the key is released by defining an "if" statement in which specifies a state of the GetKeyState to be "U", one leading to Loop and other leading to reset the parameter value to default (inside Premiere Pro).
But I don't have a clue about how to make this GetKeyState work with two keystrokes.
Tried simpler solutions, like:
Defining Shift+S to be the %VFXkey% and the macro to call.
Code: Select all
+s::
global VFXkey = "Shift & S"
instantVFX("scale")
return
Defining Shift+S to be F14
Code: Select all
+s::F14
F14::
global VFXkey = "F14"
instantVFX("scale")
return
Code: Select all
Shift::
GetKeyState("S","P")
shift := GetKeyState("LSHIFT","P")
if shift {
send s
}
else {
return,
}
+s::
global VFXkey = "S"
instantVFX("scale")
return
Code: Select all
GetKeyState, stateFirstCheck, %VFXkey%, P
GetKeyState, stateFirstCheck, Shift, P
if stateFirstCheck = U
[...]
There's the video of TaranVH explaining and showing how this works:
https://youtu.be/Bi3zBqO74ms