Skip to content

Commit

Permalink
some reorganizing, and minor updates
Browse files Browse the repository at this point in the history
* labeled "Client" and "Screen" lines for "Control under Mouse" and "Active Window" edit boxes
* reformatted strings to show multiple lines with "." concatenator
* Finally replaced GetClientSize() with WinGetClientPos()
  • Loading branch information
TheArkive committed Aug 2, 2021
1 parent 17cda38 commit ca704bb
Showing 1 changed file with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions installer/source/WindowSpy.v2.ahk
Expand Up @@ -101,38 +101,50 @@ TryUpdate() {
UpdateText("Ctrl_Freeze", oGui.txtNotFrozen)
t3 := WinGetProcessName(), t4 := WinGetPID()

UpdateText("Ctrl_Title", t1 "`nahk_class " t2 "`nahk_exe " t3 "`nahk_pid " t4 "`nahk_id " curWin)
WinDataText := t1 "`n" ; ZZZ
. "ahk_class " t2 "`n"
. "ahk_exe " t3 "`n"
. "ahk_pid " t4 "`n"
. "ahk_id " curWin

UpdateText("Ctrl_Title", WinDataText)
CoordMode "Mouse", "Window"
MouseGetPos &mrX, &mrY
CoordMode "Mouse", "Client"
MouseGetPos &mcX, &mcY
mClr := PixelGetColor(msX,msY,"RGB")
mClr := SubStr(mClr, 3)

UpdateText("Ctrl_MousePos", "Screen:`t" msX ", " msY " (less often used)`n"
. "Window:`t" mrX ", " mrY " (default)`nClient:`t" mcX ", " mcY " (recommended)`n"
. "Color:`t" mClr " (Red=" SubStr(mClr, 1, 2) " Green=" SubStr(mClr, 3, 2) " Blue=" SubStr(mClr, 5) ")")
mpText := "Screen:`t" msX ", " msY "`n"
. "Window:`t" mrX ", " mrY "`n"
. "Client:`t" mcX ", " mcY " (default)`n"
. "Color:`t" mClr " (Red=" SubStr(mClr, 1, 2) " Green=" SubStr(mClr, 3, 2) " Blue=" SubStr(mClr, 5) ")"

UpdateText("Ctrl_MousePos", mpText)

UpdateText("Ctrl_CtrlLabel", (Ctrl_FollowMouse ? oGui.txtMouseCtrl : oGui.txtFocusCtrl) ":")

if (curCtrl) {
ctrlTxt := ControlGetText(curCtrl)
cText := "ClassNN:`t" curCtrlClassNN "`nText:`t" textMangle(ctrlTxt)
WinGetClientPos(&sX, &sY, &sW, &sH, curCtrl)
ControlGetPos &cX, &cY, &cW, &cH, curCtrl
cText .= "`n`tx: " cX "`ty: " cY "`tw: " cW "`th: " cH
WinGetClientPos(&cX,&cY,,,curCtrl) ; WinToClient(curCtrl, &cX, &cY)
GetClientSize(curCtrl, &cW, &cH)
cText .= "`nClient:`tx: " cX "`ty: " cY "`tw: " cW "`th: " cH

cText := "ClassNN:`t" curCtrlClassNN "`n"
. "Text:`t" textMangle(ctrlTxt) "`n"
. "Screen:`tx: " sX "`ty: " sY "`tw: " sW "`th: " sH "`n"
. "Client`tx: " cX "`ty: " cY "`tw: " cW "`th: " cH
} else
cText := ""

UpdateText("Ctrl_Ctrl", cText)
wX := "", wY := "", wW := "", wH := ""
WinGetPos &wX, &wY, &wW, &wH, "ahk_id " curWin
WinGetClientPos(&wcX,&wcY,&wcW, &wcH,"ahk_id " curWin) ; GetClientSize(curWin, &wcW, &wcH)
WinGetClientPos(&wcX, &wcY, &wcW, &wcH, "ahk_id " curWin)

wText := "Screen:`tx: " wX "`ty: " wY "`tw: " wW "`th: " wH "`n"
. "Client:`tx: " wcX "`ty: " wcY "`tw: " wcW "`th: " wcH

UpdateText("Ctrl_Pos", "`tx: " wX "`ty: " wY "`tw: " wW "`th: " wH "`n"
. "Client:`tx: " wcX "`ty: " wcY "`tw: " wcW "`th: " wcH)
UpdateText("Ctrl_Pos", wText)
sbTxt := ""

Loop {
Expand Down

0 comments on commit ca704bb

Please sign in to comment.