maybe this help
Code: Select all
; Source: https://www.autohotkey.com/boards/viewtopic.php?f=18&t=109179&sid=3ed11ed273dfd9d5a8b4861f7f92643b
#IfWinActive, ahk_exe notepad.exe ; f2 and ESC only active when notepad.exe is focused
f2::
;Crosshair monRight Larger=Left/monBottom Larger=Up
toggle := !toggle
if toggle {
; window size
wingetpos, x,y,w,h, ahk_exe notepad.exe
diam := 27
cx := w / 2 + x - diam / 2 ; centerX keeps in mind diam window size
titleBarHeight := 30
; cross should be just below game title bar,
;cy := y + titleBarHeight ; activate this line to test if the window is just below game title bar.
; maybe your windows uses a different title bar height, increase 30 or
; decrease it until cross window is setup properly
cy := (h - titleBarHeight) / 2 + y - diam / 2 + titleBarHeight
; centerY keeps in mind diam window size
Gui -Caption +AlwaysOnTop +Owner +Disabled -SysMenu
Gui margin,0,0
Gui add, ListView, w%diam% h%diam% -Hdr -E0x200 BackgroundRed
;SysGet, mon, Monitor
; Since the game is a window, I don't think we need monitor settings
; I just set diam window position centered on game window
tooltip, % "cx " cx " cy " cy "`n w" w " h" h ; show CenterX and CenterY
Gui show, % " x" cx " y" cy
;Gui show, % "x" monRight//3.189-(diam//2) " y" monBottom//2.186-(diam//2)
WinSet, Region, 9-0 10-5 9-5 8-6 7-6 6-7 5-8 5-9 4-10 4-11 0-10 0-16 4-15 4-16 5-17 5-18 6-19 7-20 8-20 9-21 10-21 9-26 15-26 14-21 15-21 16-20 17-20 18-19 19-18 19-17 20-16 20-15 24-16 24-10 20-11 20-10 19-9 19-8 18-7 17-6 16-6 15-5 14-5 15-0 9-0 12-9 10-5 9-5 8-6 7-6 6-7 5-8 5-9 4-10 4-11 8-13 4-15 4-16 5-17 5-18 6-19 7-20 8-20 9-21 10-21 12-17 14-21 15-21 16-20 17-20 18-19 19-18 19-17 20-16 20-15 16-13 20-11 20-10 19-9 19-8 18-7 17-6 16-6 15-5 14-5 12-9, A
WinActivate, ahk_exe notepad.exe ; activate notepad.exe
} else {
Gui, destroy
tooltip, ; cancel tooltip
}
return
Esc:: ExitApp ; closing while debugging.
#if