I detect process pid of windows Calculator (if loaded)
I make the window Active.
I then move the Active (Calculator) window to position x=50, y=50
Q.
Assuming that I do not know the new x, y position (coordinates)
How to Detect and then Display in a message box the new x,y position the window was moved to ?
And what happens if I move again the Active window - to another position ?
How is that Detected and Displayed (x=?, y=?)
Code: Select all
F3::
Process, wait, calc.exe, 5.5
NewPID = %ErrorLevel% ; Save the value immediately since ErrorLevel is often changed.
if NewPID = 0
{
MsgBox The specified process did not appear within 5.5 seconds.
return
}
; Otherwise:
MsgBox A matching process has appeared (Process ID is %NewPID%).
;----------------------------
WinActivate, ahk_pid %NewPID%
;----------------------------
;
;---------------------------------
WinMove, ahk_pid %NewPID%, ,50, 50
;---------------------------------
;
; HOW PLEASE TO GET THE NEW MOUSE POSITION (X, Y) OF PROCESS PID WINDOW ?
;-------------------------------------
; ???
MouseGetPos, ahk_pid %NewPID%
Msgbox, The Process Pid new position is: X%xpos% Y%ypos%.
;--------------------------------------------------
; ???
Process, WaitClose, %NewPID%, 5
if ErrorLevel ; The PID still exists.
MsgBox The process did not close within 5 seconds.
Thank you kindly.
dzur