Hello!
I've got the Taran Premeire pro add any effects script working on a single GUI set up inside premiere.
However, I use a dual GUI set up--so when I move the effects panel to my second GUI and then change the info according to windowspy, the script goes great until the last bit of trying to drag the effect from my second GUI to the main GUI. It get stucks in the middle. Is this a normal occurrence when using MouseClickDrag between two montiors? My second GUI is in Portrait mode, however I don't think that's the problem because the script works and finds the effects panel just fine it's just the dragging.
github links to these scripts.
Here is the original script by Taran https://github.com/ifleeter/Premiere-Pro-Effects/blob/master/TARAN%20ORIGINAL%20SCRIPT
Here is the original script changed for my single GUI setup - WORKING (Completely butchered the code as you can tell but it does work) https://github.com/ifleeter/Premiere-Pro-Effects/blob/master/Single%20GUI%20-%20WORKING
Here is the original script changed for my Dual GUI setup - NOT WORKING https://github.com/ifleeter/Premiere-Pro-Effects/blob/master/Dual%20GUI%20NOT%20WORKING
AHK MouseClickDrag Works on single screen but gets stuck once adding a dual screen.
Re: AHK MouseClickDrag Works on single screen but gets stuck once adding a dual screen.
I've got this working now by changing my display settings and now the code works. I moved the second GUI that is in Portrait mode up a little so it's sitting halfway between my main GUI and all is good!
However, one thing now though, is my mouse position is not ending where it started. At the end of the script my cursor is all the way up in top left hand corner of my second GUI monitor. When it starts on the Main GUI on the selected clip.
I added a MouseMove %x%, %y% and that didn't solve the issue. Something is confused somewhere about the starting position of the mouse. Maybe one of my class windows?
However, one thing now though, is my mouse position is not ending where it started. At the end of the script my cursor is all the way up in top left hand corner of my second GUI monitor. When it starts on the Main GUI on the selected clip.
I added a MouseMove %x%, %y% and that didn't solve the issue. Something is confused somewhere about the starting position of the mouse. Maybe one of my class windows?
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.
ifWinNotActive ahk_exe Adobe Premiere Pro.exe
coordmode, pixel, Window
coordmode, mouse, Window
coordmode, Caret, Window
BlockInput, SendAndMouse
BlockInput, MouseMove
BlockInput, on
SetKeyDelay, 0
MouseGetPos, xpos, ypos
SendInput, {mbutton}
Sleep 5
Send ^+!7
Sleep 15
SendInput, ^b
Sleep 5
if (A_CaretX = "")
waiting2 = 0
loop
{
waiting2 ++
sleep 33
tooltip, counter = (%waiting2% * 33)`nCaret = %A_CaretX%
if (A_CaretX <> "")
{
tooltip, CARET WAS FOUND
break
}
if (waiting2 > 30)
{
tooltip, FAIL
sleep 200
}
}
sleep 1
tooltip,
MouseMove, %A_CaretX%, %A_CaretY%, 0
sleep 5
MouseGetPos, , , Window, classNN
WinGetClass, class, ahk_id %Window%
ControlGetPos, 40, 1262, 168, 15, Edit4, ahk_class DroverLord - Window Class, SubWindow, SubWindow
MouseMove, XX-15, YY+10, 0
sleep 5
Send Warp Stabilizer
sleep 5
MouseMove, 41, 155, 0, R
sleep 5
MouseGetPos, iconX, iconY, Window, classNN
sleep 5
WinGetClass, Class, ahk_id 32324
ControlGetPos, xxx, yyy, www, hhh, DroverLord - Window Class20, DroverLord - Window Class20, SubWindow, SubWindow
MouseMove, www/4, hhh/2, 0, R
sleep 5
MouseClick, left, , , 1
sleep 5
MouseMove, iconX, iconY, 0
sleep 5
MouseClickDrag, Left, %xposP%, %yposP%, 2, 0
sleep 5
MouseClick, middle, , , 1
blockinput, MouseMoveOff
BlockInput, off
Re: AHK MouseClickDrag Works on single screen but gets stuck once adding a dual screen.
I broke down the script and made a new script to try to mess with this what I found is if I have the starting position on my second GUI and hit the command it replaces the cursor back exactly where it was. But when I put the cursor on my main GUI it places the cursor way up in the top left corner of my second GUI.
Still trying to figure out a solve for this.
I asked in the IRC and someone directed me to read up CoordMode since I'm using that but from the manual it looked set up correctly, I even deleted those CoordMode lines and it is still performing the same.
Still trying to figure out a solve for this.
I asked in the IRC and someone directed me to read up CoordMode since I'm using that but from the manual it looked set up correctly, I even deleted those CoordMode lines and it is still performing the same.
Re: AHK MouseClickDrag Works on single screen but gets stuck once adding a dual screen.
Perhaps:
https://www.autohotkey.com/docs/commands/MouseMove.htm#Remarks wrote:The following is an alternate way to move the mouse cursor that may work better in certain multi-monitor configurations:
Code: Select all
DllCall("SetCursorPos", "int", 100, "int", 400) ; The first number is the X-coordinate and the second is the Y (relative to the screen).
Re: AHK MouseClickDrag Works on single screen but gets stuck once adding a dual screen.
Gregster, thank you so much for the tip--going to test this.
I actually just finally solved this! However, I'm sure the code is not clean from an experienced AHK writer. So to get this working I had to re position some lines. Namely, the initial MouseGetPos x, y had to be placed after the Send ^+!7 In testing I found out that the cursor would move back to the starting position on my GUI IF no panels on my GUI were selected. The Send ^+!7 selects the effects panel on my second GUI and then I can store my MouseGetPos since nothing on my GUI is selected and it works!
It's not clean but it's working and i'm sure i'll run into issues somewhere down the line! I'm going to try to add in the alternative you suggested but might take me sometime to figure that command out. Reading on it now.
Thanks again!
Here is the new working script to apply specifically Warp Stabilizer in Premiere Pro using Taran's template.
I actually just finally solved this! However, I'm sure the code is not clean from an experienced AHK writer. So to get this working I had to re position some lines. Namely, the initial MouseGetPos x, y had to be placed after the Send ^+!7 In testing I found out that the cursor would move back to the starting position on my GUI IF no panels on my GUI were selected. The Send ^+!7 selects the effects panel on my second GUI and then I can store my MouseGetPos since nothing on my GUI is selected and it works!
It's not clean but it's working and i'm sure i'll run into issues somewhere down the line! I'm going to try to add in the alternative you suggested but might take me sometime to figure that command out. Reading on it now.
Thanks again!
Here is the new working script to apply specifically Warp Stabilizer in Premiere Pro using Taran's template.
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.
SetDefaultMouseSpeed, 0
BlockInput, SendAndMouse
BlockInput, MouseMove
BlockInput, on
Sleep 5
Send ^+!7
Sleep 15
MouseGetPos x, y
SendInput, ^b
Sleep 5
if (A_CaretX = "")
waiting2 = 0
loop
{
waiting2 ++
sleep 33
tooltip, counter = (%waiting2% * 33)`nCaret = %A_CaretX%
if (A_CaretX <> "")
{
tooltip, CARET WAS FOUND
break
}
if (waiting2 > 30)
{
tooltip, FAIL
sleep 200
}
}
sleep 1
tooltip,
MouseMove, %A_CaretX%, %A_CaretY%, 0
sleep 5
MouseGetPos, , , Window, classNN
WinGetClass, class, ahk_id 32324
ControlGetPos, 40, 1262, 168, 15, Edit4, ahk_class Premiere Pro, SubWindow, SubWindow
MouseMove, XX-15, YY+10, 0
sleep 5
Send Warp Stabilizer
sleep 5
MouseMove, 41, 155, 0, R
sleep 5
MouseGetPos, iconX, iconY, Window, classNN
sleep 5
WinGetClass, Class, ahk_id 32324
ControlGetPos, xxx, yyy, www, hhh, Edit4, DroverLord - Window Class, SubWindow, SubWindow
MouseMove, www/4, hhh/2, 0, R
sleep 5
MouseClick, left, , , 1
sleep 5
MouseMove, iconX, iconY, 0
sleep 5
MouseClickDrag, Left, %xposP%, %yposP%, 2, 0
MouseMove %x%, %y%
blockinput, MouseMoveOff
BlockInput, off
Re: AHK MouseClickDrag Works on single screen but gets stuck once adding a dual screen.
Ah! Taran and his Spaghetti code... He's kinda the reason why I got deeper into AHK, but his functions are nasty and I spent several weeks rewriting and improving them.
In this case, I found that it is more reliable to use the Panel's corner coordinates that you get with:
Then you add an offset to these coordinates to get where you want, depending on your coordinates system. I've written a helper function to help me calculate that offset automatically and get other useful info:
In this case, I found that it is more reliable to use the Panel's corner coordinates that you get with:
Code: Select all
ControlGetFocus, EffectsPanel , A
ControlGetPos, Xcorner, Ycorner, Width, Height, %EffectsPanel%, A
Code: Select all
OffsetCalculator(Mode){
local ; this forces the script to consider all the variables within this function as local
Keywait, %A_ThisHotkey% ;;; this makes sure you release the keys before proceeding with the function so that the modifiers you press don't get in the way
if Mode = Client
{
coordmode, mouse, Client
coordmode, pixel, Client
}
else if Mode = Screen
{
coordmode, mouse, Screen
coordmode, pixel, Screen
}
else ;;; Mode = "Window" is assumed the Default
{
Mode:= "Window"
coordmode, mouse, Window
coordmode, pixel, Window
}
tooltip, Make sure that the panel you want to calculate the offset from is activated`nthen place the mouse over the area you want`nand press "Scroll Lock key", 900, 0
keywait, Scrolllock, D
keywait, Scrolllock
tooltip,
Blockinput, on
;;; ControlGetPos sometimes takes too long to find the window. This loop ensures that it gets a value before continuing on. This way, we are sure to click on the right position after
GetPosChecker:=0
While GetPosChecker=0
{
ControlGetFocus, FocusedPanel , A ;;; gets the identifier of the panel in focus
ControlGetPos, Xcorner, Ycorner, Width, Height,%FocusedPanel%, A ;;; get the position of the identified panel
GetPosChecker:=Xcorner
tooltip, Please Wait...
Sleep 20
}
GetPosChecker:=0
tooltip,
MouseGetPos, XPos, YPos
Pixelgetcolor, MouseColor, XPos, YPos
Pixelgetcolor, MouseColorRGB, XPos, YPos , RGB
OffsetX:= XPos - Xcorner
OffsetY:= YPos - Ycorner
MouseMove, 500,500, 0, r
Sleep 100
Pixelgetcolor, AwayColor, XPos, YPos
Pixelgetcolor, AwayColorRGB, XPos, YPos , RGB
Clipboard:= ";;; CoordMod Used: " Mode " Offset X: " OffsetX " Offset Y: " OffsetY " color mouse on: " MouseColor " //RGB:" MouseColorRGB " Color Mouse away: " Awaycolor " //RGB:" AwayColorRGB " - found with OffsetCalculator(Mode)"
MouseMove, Xpos, YPos
Blockinput, off
MsgBox, Coordinate Mode used: %Mode% `n`nThe offset values are:`n-on X: %OffsetX%`n-on Y: %OffsetY%`n`nThe color under the mouse when the mouse is over it is:`n %MouseColor% , in RGB: %MouseColorRGB%`nnThe color in that position when the mouse is away is:`n%AwayColor% , in RGB: %AwayColorRGB% `n`nYou have this data copied to your clipboard
return
}