ControlGetPos works in small script, not in longer one
Posted: 05 Dec 2019, 21:58
I'm trying to automate something in Adobe Premiere. This is my first day with AHK, so please excuse the simpleton code
If I run this script while the "Export" window is open, it puts the cursor where I expect
However, if I do this in this script where it first opens the "Export" window, it never gets the control's coords, though it will move the cursor from the relative command
If I run this script while the "Export" window is open, it puts the cursor where I expect
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.
if WinExist("ahk_exe Adobe Premiere Pro.exe")
WinActivate, ahk_exe Adobe Premiere Pro.exe
else
Exit
SendInput +4 ; Adobe Premiere short cut to the program window, otherwise, export may not open
Sleep, 500
ControlFocus ,Edit19
ControlGetPos, X, Y,,,Edit19
;MsgBox ,,%X% %Y%
MouseMove %X%, %Y%, 20
MouseMove, 0, 55, 20, R
MouseClick
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.
if WinExist("ahk_exe Adobe Premiere Pro.exe")
WinActivate, ahk_exe Adobe Premiere Pro.exe
else
Exit
SendInput +4 ; Adobe Premiere short cut to the program window, otherwise, export may not open
Sleep, 500
; should work doesn't 'SendInput ^M ; Ctrl+M to open Export Media window'
SendInput !F
Sleep, 500
Send e
Sleep, 500
Send e
Send {Right}
Sleep, 500
Send {Enter}
;SendInput +4 ; Adobe Premiere short cut to the program window, otherwise, export may not open
Sleep, 1000
Send, {Tab}
Sleep, 500
Send, {Tab}
Sleep, 500
Send, {Tab}
Sleep, 500
Send, {Tab}
Sleep, 500
Send, {Tab}
Sleep, 500
Send, {Tab}
Sleep, 500
; we should be there anyway now
ControlFocus ,Edit19
Sleep, 500
ControlGetPos, X, Y,,,Edit19 ; NOT WORKING IN THIS SCRIPT? WHY?
;MsgBox ,,%X% %Y%
MouseMove %X%, %Y%, 20
MouseMove, 0, 55, 20, R
MouseClick