#NoEnv
SetTitleMatchMode, 2
; IMPORTANT: Use 'Screen' for initial targeting to bridge the gap between terminals
CoordMode, ToolTip, Screen
CoordMode, Gui, Screen
TargetProcess := "ahk_exe idea64.exe"
; 1. Find the window
ID := WinExist(TargetProcess)
if (ID)
{
; 2. FORCED TELEPORT
WinActivate, ahk_id %ID%
WinWaitActive, ahk_id %ID%, , 2
; 3. THE FIX: Loop until we get REAL coordinates (not 0,0)
; Sometimes Windows takes a second to report position after a desktop switch
Loop, 10 {
WinGetPos, iX, iY, iW, iH, ahk_id %ID%
if (iW > 0)
break
Sleep, 100
}
; 4. CALCULATE CENTER BASED ON GLOBAL SCREEN
; This ignores "which window is active" and uses absolute screen pixels
CenterX := iX + (iW / 2)
CenterY := iY + (iH / 2)
; 5. DRAW RED DOT
Gui, Dot: +AlwaysOnTop -Caption +ToolWindow +LastFound
Gui, Dot: Color, Red
; Show using absolute screen coordinates
Gui, Dot: Show, % "x" (CenterX - 10) " y" (CenterY - 10) " w20 h20 NoActivate"
; 6. PINNED MESSAGE (Using the SmartAlert logic from before)
SmartAlert("SUCCESS", "Found you at: " iX "," iY, CenterX, CenterY)
}
else
{
MsgBox, 16, Error, IntelliJ not found.
}
return
SmartAlert(Title, Message, CX, CY) {
Gui, Msg: +AlwaysOnTop -MinimizeBox
Gui, Msg: Font, s14 w700
Gui, Msg: Add, Text, Center w250, %Message%
Gui, Msg: Add, Button, gClose w80 x95, OK
; Place the MsgBox exactly where the Red Dot was
Gui, Msg: Show, % "x" (CX - 125) " y" (CY - 50), %Title%
return
Close:
Gui, Msg: Destroy
ExitApp
}
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)