Advertisement
Guest User

Untitled

a guest
Oct 4th, 2019
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #NoEnv
  2. #NoTrayIcon
  3. #SingleInstance Ignore
  4. SetWorkingDir, %A_ScriptDir%
  5. SetBatchLines, -1
  6. CoordMode, Pixel, Screen
  7. IfExist, ..\toolicon.icl
  8. Menu, Tray, Icon, ..\toolicon.icl, 9
  9. isUpd := true
  10. txtNotFrozen := "(Win+A to freeze display)"
  11. txtFrozen := "(Win+A to unfreeze display)"
  12. Gui, New, hwndhGui AlwaysOnTop Resize MinSize
  13. Gui, Add, Text,, Window Title, Class and Process:
  14. Gui, Add, Edit, w320 r3 ReadOnly -Wrap vCtrl_Title
  15. Gui, Add, Text,, Mouse Position:
  16. Gui, Add, Edit, w320 r3 ReadOnly vCtrl_MousePos
  17. Gui, Add, Text,, Control Under Mouse Position:
  18. Gui, Add, Edit, w320 r5 ReadOnly vCtrl_MouseCur
  19. Gui, Add, Text,, Active Window Position:
  20. Gui, Add, Edit, w320 r2 ReadOnly vCtrl_Pos
  21. Gui, Add, Text,, Status Bar Text:
  22. Gui, Add, Edit, w320 r2 ReadOnly vCtrl_SBText
  23. Gui, Add, Checkbox, vCtrl_IsSlow, Slow TitleMatchMode
  24. Gui, Add, Text,, Visible Text:
  25. Gui, Add, Edit, w320 r2 ReadOnly vCtrl_VisText
  26. Gui, Add, Text,, All Text:
  27. Gui, Add, Edit, w320 r2 ReadOnly vCtrl_AllText
  28. Gui, Add, Text, w320 r1 vCtrl_Freeze, % txtNotFrozen
  29. Gui, Show,, Active Window Info
  30. GetClientSize(hGui, temp)
  31. horzMargin := temp*96//A_ScreenDPI - 320
  32. SetTimer, Update, 250
  33. return
  34. GuiSize:
  35. Gui %hGui%:Default
  36. if !horzMargin
  37. return
  38. ctrlW := A_GuiWidth - horzMargin
  39. list = Title,MousePos,MouseCur,Pos,SBText,VisText,AllText,Freeze
  40. Loop, Parse, list, `,
  41. GuiControl, Move, Ctrl_%A_LoopField%, w%ctrlW%
  42. return
  43. Update:
  44. Gui %hGui%:Default
  45. curWin := WinExist("A")
  46. if (curWin = hGui)
  47. return
  48. WinGetTitle, t1
  49. WinGetClass, t2
  50. WinGet, t3, ProcessName
  51. GuiControl,, Ctrl_Title, % t1 "`nahk_class " t2 "`nahk_exe " t3
  52. CoordMode, Mouse, Screen
  53. MouseGetPos, msX, msY, msWin, msCtrlHwnd, 2
  54. CoordMode, Mouse, Relative
  55. MouseGetPos, mrX, mrY,, msCtrl
  56. CoordMode, Mouse, Client
  57. MouseGetPos, mcX, mcY
  58. GuiControl,, Ctrl_MousePos, % "Absolute:`t" msX ", " msY " (less often used)`nRelative:`t" mrX ", " mrY " (default)`nClient:`t" mcX ", " mcY " (recommended)"
  59. PixelGetColor, mClr, %msX%, %msY%, RGB
  60. mClr := SubStr(mClr, 3)
  61. mText := "`nColor:`t" mClr " (Red=" SubStr(mClr, 1, 2) " Green=" SubStr(mClr, 3, 2) " Blue=" SubStr(mClr, 5) ")"
  62. if (curWin = msWin)
  63. {
  64. ControlGetText, ctrlTxt, %msCtrl%
  65. mText := "ClassNN:`t" msCtrl "`nText:`t" textMangle(ctrlTxt) mText
  66. ControlGetPos cX, cY, cW, cH, %msCtrl%
  67. mText .= "`n`tx: " cX "`ty: " cY "`tw: " cW "`th: " cH
  68. WinToClient(msWin, cX, cY)
  69. GetClientSize(msCtrlHwnd, cW, cH)
  70. mText .= "`nClient:`tx: " cX "`ty: " cY "`tw: " cW "`th: " cH
  71. } else mText := "`n" mText
  72. GuiControl,, Ctrl_MouseCur, % mText
  73. WinGetPos, wX, wY, wW, wH
  74. GetClientSize(curWin, wcW, wcH)
  75. GuiControl,, Ctrl_Pos, % "`tx: " wX "`ty: " wY "`tw: " wW "`th: " wH "`nClient:`t`t`tw: " wcW "`th: " wcH
  76. sbTxt := ""
  77. Loop
  78. {
  79. StatusBarGetText, ovi, %A_Index%
  80. if ovi =
  81. break
  82. sbTxt .= "(" A_Index "):`t" textMangle(ovi) "`n"
  83. }
  84. StringTrimRight, sbTxt, sbTxt, 1
  85. GuiControl,, Ctrl_SBText, % sbTxt
  86. GuiControlGet, bSlow,, Ctrl_IsSlow
  87. SetTitleMatchMode, % bSlow ? "Slow" : "Fast"
  88. DetectHiddenText, Off
  89. WinGetText, ovVisText
  90. DetectHiddenText, On
  91. WinGetText, ovAllText
  92. GuiControl,, Ctrl_VisText, % ovVisText
  93. GuiControl,, Ctrl_AllText, % ovAllText
  94. return
  95. GuiClose:
  96. ExitApp
  97. GetClientSize(hWnd, ByRef w := "", ByRef h := "")
  98. {
  99. VarSetCapacity(rect, 16)
  100. DllCall("GetClientRect", "ptr", hWnd, "ptr", &rect)
  101. w := NumGet(rect, 8, "int")
  102. h := NumGet(rect, 12, "int")
  103. }
  104. WinToClient(hWnd, ByRef x, ByRef y)
  105. {
  106. WinGetPos wX, wY,,, ahk_id %hWnd%
  107. x += wX, y += wY
  108. VarSetCapacity(pt, 8), NumPut(y, NumPut(x, pt, "int"), "int")
  109. if !DllCall("ScreenToClient", "ptr", hWnd, "ptr", &pt)
  110. return false
  111. x := NumGet(pt, 0, "int"), y := NumGet(pt, 4, "int")
  112. return true
  113. }
  114. textMangle(x)
  115. {
  116. if pos := InStr(x, "`n")
  117. x := SubStr(x, 1, pos-1), elli := true
  118. if StrLen(x) > 40
  119. {
  120. StringLeft, x, x, 40
  121. elli := true
  122. }
  123. if elli
  124. x .= " (...)"
  125. return x
  126. }
  127. #a::
  128. Gui %hGui%:Default
  129. isUpd := !isUpd
  130. SetTimer, Update, % isUpd ? "On" : "Off"
  131. GuiControl,, Ctrl_Freeze, % isUpd ? txtNotFrozen : txtFrozen
  132. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement