MouseGetPos, xpos, ypos by referencing Process PID ?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
dzur
Posts: 71
Joined: 15 Jul 2016, 10:44

MouseGetPos, xpos, ypos by referencing Process PID ?

18 Jan 2018, 21:51

Hello,
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.
Please Help.
Thank you kindly.
dzur
User avatar
divanebaba
Posts: 805
Joined: 20 Dec 2016, 03:53
Location: Diaspora

Re: MouseGetPos, xpos, ypos by referencing Process PID ?

18 Jan 2018, 22:00

Einfach nur ein toller Typ. :mrgreen:
User avatar
dzur
Posts: 71
Joined: 15 Jul 2016, 10:44

Re: MouseGetPos, xpos, ypos by referencing Process PID ?

18 Jan 2018, 22:19

OK !
Thx ! :D
Get back to you in a while...hope you are still there to help me again !
I really appreciate this friend !
dzur

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Araphen, mcd, ShatterCoder and 86 guests