/Source/AHK_Window_Info/AHK_Window_Info_v1.7.ahk

http://autohotkey-cn.googlecode.com/ · AutoHotKey · 1915 lines · 1452 code · 247 blank · 216 comment · 14 complexity · 9a6fc7e71cfae84680da5b2dd1711558 MD5 · raw file

Large files are truncated click here to view the full file

  1. ;Reveal information on windows, controls, etc.
  2. ;by toralf
  3. ;requires AHK 1.0.44.04
  4. ;www.autohotkey.com/forum/topic8976.html
  5. ScriptName = AHK Window Info 1.7
  6. ; License: Attribution-NonCommercial-ShareAlike 2.5 licence from Creative Commons
  7. ; for details see: http://creativecommons.org/licenses/by-nc-sa/2.5/legalcode
  8. ;
  9. ; export code by sosaited www.autohotkey.com/forum/viewtopic.php?t=8732&p=53372#53372
  10. ; idea and lot of code of frame drawing by shimanov
  11. ; several ideas from Chris and other users of the AHK forum
  12. ; initial ideas taken from these scripts:
  13. ; Ahk Window Spy 1.3.3 by Decarlo www.autohotkey.com/forum/viewtopic.php?t=4679
  14. ; WinInfo Menu by Jon www.autohotkey.com/forum/viewtopic.php?t=8617
  15. ;changes since 1.6
  16. ; - added a small gap in the mouse picker grid to identify the center (thanks fade2gray)
  17. ; - adjusted groupbox size and tab size
  18. ; - added reset of picker to default color on dimensional change
  19. ;changes since 1.5
  20. ; - Groupboxes with bold text have been set -wrap, to fix line breaks on some windows themes
  21. ; - BGR is made default for color picker
  22. ; - update is stopped when mouse moves over its own gui, allowing easier graping of data, since no Pause key needs to be pressed.
  23. ;changes since 1.4
  24. ; - "H" replaced with Hwnd; "P" and "S" with "Pos" and "Size" on advanced tab for Control
  25. ; - GroupBox names have bold font
  26. ; - Mouse color picker is only updated when mouse tab is visible. Otherwise set to gray
  27. ; - set default for color picker to 15x15, since it only influences CPU load when the mouse tab is visible
  28. ; - controls list items are only updated when advanced tab is visible. Otherwise set to ">>>not updated<<<""
  29. ; - windows statusbar text is only updated when advanced tab is visible. Otherwise set to ">>>not updated<<<""
  30. ; - fast/slow visible/hidden window text are only updated when advanced tab is visible. Otherwise set to ">>>not updated<<<""
  31. ;todo
  32. ; - Window Info should be tested on Windows 9x
  33. ;changes since 1.3
  34. ; - last tab gets remembered between starts
  35. ; - large list hides automatically when tab is not "Advanced"
  36. ; - by default not rectangle is drawn around controls
  37. ; - gui starts NoActivate
  38. ; - fixed a problem with hidden gui and pause key
  39. ; - reduced impact in hidden mode on CPU load to nearly 0
  40. ; - to support 800x600 screen resolutions the advanced tab initial height is 600
  41. ; - instead of auto-update, update of data can be done on mouse click (button can be L/M/R, default M)
  42. ; - when started with "HideGui" turned on: GUI starts hidden, after 500 ms data is collected and GUI shown
  43. ; - changed licence to Attribution-NonCommercial-ShareAlike 2.5 licence from Creative Commons
  44. ;changes since 1.2
  45. ; - added: Control handle to advanced and list view
  46. ; - improved: fixed some spelling mistakes
  47. ; - fixed: option "Show tooltip at cursor" had no effect
  48. ; - fixed: option "Show tooltip at cursor" wasn't remembered between sessions
  49. ; - improved: For all DllCall's the types are put in quotes
  50. ; - changed: coordinates and sizes will have a space after the comma when put on clipboard
  51. ; - changed: the number of characters in the GUI for the list items is limited to 200. Clipboard will receive all
  52. ; - changed: "Introduction - Please Read" button moved to new info tab
  53. ; - changed: Renamed "active control in window" to "focused control in window".
  54. ; - fixed: Window Info refused to minimize while the right-side list was displayed.
  55. ; - changed: While Window Info is minimized, updating of data is turned off
  56. ; - fixed: Coordinates of GUI got stored when GUI got closed minimized
  57. ;changes since 1.1
  58. ; - added: OnExit routine that cleans up frame gui if script exits unexpectedly
  59. ; - changed: Tooltip of control frame disappears when mouse gets moved onto it.
  60. ; - changed: font size of GUI is now 6pt
  61. ;changes since 1.0
  62. ; - improved: specified the font for the GUI, MS Sans Serif, 8 point
  63. ; - changed: for some OS (WIN_2000,WIN_NT4,WIN_95,WIN_98,WIN_ME) the icon is changed to ID 57
  64. ; - improved: small features that simplify maintenance
  65. ; + combine update routines
  66. ; + simplify options actions
  67. ; + simplify Pause Key actions
  68. ; + reorder code
  69. ; - improved: new method to capture fast/slow visible/hidden window text (Thanks Chris)
  70. ; - changed: Gui (advanced) now holds fields for fast/slow visible/hidden window text
  71. ; - added: option to switch color picker between RGB and BGR
  72. ; - improved: color picker only updates when mouse moves or color below mouse changes. This reduces jittery update.
  73. ; - changed: Color picker now has a 15x15 color matrix
  74. ; - changed: checkbox "Show right List" changed to button that alternates between "More Info >>" and "<< Less Info".
  75. ; - added: check for minium required AHK version
  76. ; - added: new option to turn auto-update automatically ON when Gui gets inactive (if it had been turned off (by pause or by the large list))
  77. /*
  78. Requests:
  79. [quote="Chris"]Sometimes pressing Window Info's minimize button fails to work.[/quote]I still can't reproduce it. I tried it 20 times any each time the window minimized
  80. [quote="Chris"]I've made a note to test it on Win9x prior to distribution.[/quote]Please do. Or is there someone else out there to do the testing. Would be very much appreaciated.
  81. [quote="Chris"]Minor typos in source code comments: "or less or" should be "or else" in 2 places.[/quote]The two cases where "or less or" is written are actually correct.
  82. */
  83. AHK_version = 1.0.44.04
  84. If not A_IsCompiled ;if it is a script
  85. CheckAHKVersion(AHK_version) ;check if minimum AHK Version is installed
  86. InformationText =
  87. (LTrim
  88. This Gui will reveal information on windows, controls, etc.
  89. This software is under the GNU General Public License for details see: www.autohotkey.com/docs/license.htm
  90. Move your mouse over the area of interest and see the data in this GUI changing accordingly (auto-update). The auto-update stops when this GUI becomes the active one. To achieve this without moving the mouse you can use Alt+Tab to change to %ScriptName%. Or you can use a hotkey to turn the auto-update off. The default hotkey is the Pause key.
  91. When the data for the large list is collected (advanced tab), the auto-update of the data is stopped automatically to allow you to work with the data. Use the toggle hotkey (see below) to create a new snapshot of data. Or turn on the option, to start updating again when the GUI gets deactivated.
  92. These shortcuts exist:
  93. =================
  94. => Toggle Auto-Update Hotkey (default: Pause):
  95. ---------------------------------------------------------------------------
  96. Toggles (start/stop) auto-updating data in GUI OR creates a new snapshot of data when auto-update has been stopped automatically.
  97. => Left-Mouse Button:
  98. ---------------------------------------
  99. Copies the content of a control to the clipboard. This is achieved in the code with OnMessage(), thus it should not interfere with any of your own hotkeys.
  100. => Middle-Mouse Button:
  101. ---------------------------------------
  102. Toggles AlwaysOnTop status of this window. Click inside the window, it will not work on the titlebar. This is achieved in the code with OnMessage(), thus it should not interfere with any of your own hotkeys.
  103. => Win+s hotkey combination:
  104. ------------------------------------------------
  105. Exports data to file. It will only work, when auto-update has been stopped.
  106. Remarks:
  107. =======
  108. - You can change the toggle auto-update hotkey in the advanced options (you will not see keys that do not produces visible characters, e.g. the default Pause key). A key has to be specified. A single Ctrl, Shift, Alt, Win key or their combinations are not allowed.
  109. - The advanced option "Hide/Show Gui" allows you to create snapshots of data while the GUI is hidden. The toggle auto-update hotkey will toggle the visibility of the GUI. Just before the GUI is shown again the data gets collected and the GUI updated.
  110. - Log to file only works when auto-update has been stopped.
  111. - Specify a file name you want to save the data too. Insert #'s into the filename, if you want %ScriptName% to number the files automatically.
  112. )
  113. #SingleInstance force
  114. ;set working dir, in case this script is called from some other script in a different dir
  115. SetWorkingDir, %A_ScriptDir%
  116. GoSub, ReadIni
  117. GoSub, CreateTrayMenu
  118. GoSub, BuildGui
  119. WindowControlTextSize = 32767 ; Must be 32767 or less or it won't work on Windows 95.
  120. VarSetCapacity(WindowControlText, WindowControlTextSize)
  121. ControlTextSize = 512 ; Must be 32767 or less or it won't work on Windows 95.
  122. VarSetCapacity(ControlText, ControlTextSize)
  123. ;activate auto-update toggle hotkey
  124. HotKey, %HtkPauseAction%, PauseAction, On
  125. ;toggle AOT attribute of GUI with middle mouse click
  126. WM_MBUTTONDOWN = 0x207
  127. OnMessage(WM_MBUTTONDOWN, "ToggleOnTopGui1")
  128. ;initialize Save hotkey, so it can be easily turned on/off
  129. HotKey, #s, BtnSaveExport, Off
  130. ;initialize update on click hotkey, so it can be easily turned on/off
  131. Hotkey, IfWinNotActive, ahk_id %Gui1UniqueID%
  132. Hotkey, ~%CbbHtkUpdate%, UpdateOnClick, Off
  133. Hotkey, IfWinNotActive
  134. ;activate update on click
  135. If RadUpdateOnClick {
  136. Hotkey, IfWinNotActive, ahk_id %Gui1UniqueID%
  137. Hotkey, ~%CbbHtkUpdate%, On
  138. Hotkey, IfWinNotActive
  139. }Else{
  140. ;activate auto-start updating at Gui inactivity
  141. WM_ACTIVATE = 0x6
  142. If ChkAutoStartUpdate
  143. OnMessage(WM_ACTIVATE, "WM_ACTIVATE")
  144. ;set timer once, so that it knows its interval and can be easily turned on/off
  145. UpdateIsStopped := True
  146. SetTimer, UpdateInfo, %CbbUpdateInterval%
  147. If ChkHideGui {
  148. Sleep, 500
  149. Gosub, PauseAction
  150. ToolTip("Press Pause to hide GUI again", 2000)
  151. }Else
  152. UpdateIsStopped := False
  153. }
  154. ;activate copy-on-click for left mouse click
  155. WM_LBUTTONDOWN = 0x201
  156. If ChkCopyToCB
  157. OnMessage(WM_LBUTTONDOWN, "WM_LBUTTONDOWN")
  158. ;set static parameters to draw frames around control and window
  159. Sysget, ScreenWidth, 78 ; get screen size from virtual screen
  160. Sysget, ScreenHeight, 79
  161. frame_cc = 0x0000FF ;set color for frame, 0x00BBGGRR
  162. frame_cw = 0x00FF00 ;set color for frame, 0x00BBGGRR
  163. frame_t = 2 ;set line thickness for frame, 1-10
  164. GoSub, ToogleExportActions
  165. GoSub, PrepareFrameDraw ;create or destroy frame drawing objects
  166. OnExit, ExitSub
  167. Return
  168. ;######## End of Auto-Exec-Section
  169. ExitSub:
  170. GoSub, CleanUpFrameGui
  171. Sleep,50
  172. ExitApp
  173. Return
  174. ReadIni:
  175. SplitPath, A_ScriptName, , , , OutNameNoExt
  176. IniFile = %OutNameNoExt%.ini
  177. IniRead, Gui1Pos , %IniFile%, Settings, Gui1Pos , x0 y0
  178. IniRead, Gui1AOTState , %IniFile%, Settings, Gui1AOTState , 1
  179. IniRead, Tab1 , %IniFile%, Settings, Tab1 , 1
  180. IniRead, RadWindow , %IniFile%, Settings, RadWindow , 2
  181. IniRead, RadControl , %IniFile%, Settings, RadControl , 2
  182. IniRead, SelectedRadList , %IniFile%, Settings, SelectedRadList , 1
  183. IniRead, ChkShowList , %IniFile%, Settings, ChkShowList , 0
  184. IniRead, HtkPauseAction , %IniFile%, Settings, HtkPauseAction , Pause
  185. IniRead, ChkCopyToCB , %IniFile%, Settings, ChkCopyToCB , 1
  186. IniRead, ChkHideGui , %IniFile%, Settings, ChkHideGui , 0
  187. IniRead, ChkUseSaveHotkey , %IniFile%, Settings, ChkUseSaveHotkey , 0
  188. IniRead, ChkExportMousePosScreen , %IniFile%, Export , ChkExportMousePosScreen, 1
  189. IniRead, ChkExportMousePosAWin , %IniFile%, Export , ChkExportMousePosAWin , 0
  190. IniRead, ChkExportMousePosWin , %IniFile%, Export , ChkExportMousePosWin , 1
  191. IniRead, ChkExportMousePointer , %IniFile%, Export , ChkExportMousePointer , 0
  192. IniRead, ChkExportMouseColorRGB , %IniFile%, Export , ChkExportMouseColorRGB , 0
  193. IniRead, ChkExportMouseColorHex , %IniFile%, Export , ChkExportMouseColorHex , 0
  194. IniRead, ChkExportCtrlText , %IniFile%, Export , ChkExportCtrlText , 1
  195. IniRead, ChkExportCtrlClass , %IniFile%, Export , ChkExportCtrlClass , 1
  196. IniRead, ChkExportCtrlPos , %IniFile%, Export , ChkExportCtrlPos , 0
  197. IniRead, ChkExportCtrlSize , %IniFile%, Export , ChkExportCtrlSize , 0
  198. IniRead, ChkExportCtrlListItems , %IniFile%, Export , ChkExportCtrlListItems , 0
  199. IniRead, ChkExportWinTitle , %IniFile%, Export , ChkExportWinTitle , 1
  200. IniRead, ChkExportWinPos , %IniFile%, Export , ChkExportWinPos , 0
  201. IniRead, ChkExportWinSize , %IniFile%, Export , ChkExportWinSize , 0
  202. IniRead, ChkExportWinClass , %IniFile%, Export , ChkExportWinClass , 1
  203. IniRead, ChkExportWinProcess , %IniFile%, Export , ChkExportWinProcess , 1
  204. IniRead, ChkExportWinUID , %IniFile%, Export , ChkExportWinUID , 0
  205. IniRead, ChkExportWinPID , %IniFile%, Export , ChkExportWinPID , 0
  206. IniRead, ChkExportWinStatusText , %IniFile%, Export , ChkExportWinStatusText , 1
  207. IniRead, ChkExportWinText , %IniFile%, Export , ChkExportWinText , 1
  208. IniRead, ChkExportLargeList , %IniFile%, Export , ChkExportLargeList , 1
  209. IniRead, EdtExportFile , %IniFile%, Export , EdtExportFile , AHK_Window_Info_Data_###.txt
  210. IniRead, ChkExportAutoNumber , %IniFile%, Export , ChkExportAutoNumber , 1
  211. IniRead, ChkExportAppend , %IniFile%, Export , ChkExportAppend , 0
  212. IniRead, ChkShowInfoToolTip , %IniFile%, Advanced, ChkShowInfoToolTip , 1
  213. IniRead, ChkDrawRectCtrl , %IniFile%, Advanced, ChkDrawRectCtrl , 0
  214. IniRead, ChkDrawRectWin , %IniFile%, Advanced, ChkDrawRectWin , 0
  215. IniRead, ChkTtpMaster , %IniFile%, Advanced, ChkTtpMaster , 0
  216. IniRead, ChkTtpMSPos , %IniFile%, Advanced, ChkTtpMSPos , 0
  217. IniRead, ChkTtpMWPos , %IniFile%, Advanced, ChkTtpMWPos , 1
  218. IniRead, ChkTtpMColor , %IniFile%, Advanced, ChkTtpMColor , 1
  219. IniRead, ChkTtpCClass , %IniFile%, Advanced, ChkTtpCClass , 1
  220. IniRead, ChkTtpCPos , %IniFile%, Advanced, ChkTtpCPos , 0
  221. IniRead, ChkTtpCSize , %IniFile%, Advanced, ChkTtpCSize , 0
  222. IniRead, ChkTtpWClass , %IniFile%, Advanced, ChkTtpWClass , 1
  223. IniRead, ChkTtpWTitle , %IniFile%, Advanced, ChkTtpWTitle , 1
  224. IniRead, CbbUpdateInterval , %IniFile%, Advanced, CbbUpdateInterval , 100
  225. IniRead, CbbColorPickDim , %IniFile%, Advanced, CbbColorPickDim , 15x15
  226. IniRead, RadColorPick , %IniFile%, Advanced, RadColorPick , 2
  227. IniRead, ChkAutoStartUpdate , %IniFile%, Advanced, ChkAutoStartUpdate , 1
  228. IniRead, CbbHtkUpdate , %IniFile%, Advanced, CbbHtkUpdate , MButton
  229. IniRead, RadUpdateOnClick , %IniFile%, Advanced, RadUpdateOnClick , 0
  230. IniRead, RadUpdateAuto , %IniFile%, Advanced, RadUpdateAuto , 1
  231. Return
  232. CreateTrayMenu:
  233. ;location of icon file
  234. IconFile := A_WinDir "\system" iif(A_OSType = "WIN32_WINDOWS","","32") "\shell32.dll"
  235. ;create traybar menu
  236. ;icon for taskbar and for proces in task manager
  237. If A_OSVersion in WIN_2000,WIN_NT4,WIN_95,WIN_98,WIN_ME
  238. Menu, Tray, Icon, %IconFile%, 57
  239. Else
  240. Menu, Tray, Icon, %IconFile%, 172
  241. Menu, Tray, NoStandard
  242. Menu, Tray, Tip, %ScriptName%
  243. Menu, Tray, Add, Show, GuiShow
  244. Menu, Tray, Default, Show
  245. Menu, Tray, Add, Exit, GuiClose
  246. Menu, Tray, Click, 1
  247. Return
  248. GuiShow:
  249. Gui, 1:Show ;show window again if it has been hidden
  250. Return
  251. BuildGui:
  252. GuiIsVisible := False
  253. Gui, 1: +Resize +LastFound
  254. Gui1UniqueID := WinExist()
  255. Gui, 1:Font, s6, MS Sans Serif
  256. Gui, 1:Margin, 0, 0
  257. Gui, 1:Add, Tab, w287 h145 vTab1 gTab1 AltSubmit -Wrap , Simple|Advanced|Mouse|Options|Info
  258. Gui, 1:Tab, Simple
  259. Gui, 1:Add, Text, x5 y28 , Window Title
  260. Gui, 1:Add, Edit, x+2 yp-3 w211 vEdtEasyWindowTitle,
  261. Gui, 1:Add, Text, x5 y+5, Window Class
  262. Gui, 1:Add, Edit, x+2 yp-3 w206 vEdtEasyWindowClass,
  263. Gui, 1:Add, Text, x5 y+5, Control ClassNN
  264. Gui, 1:Add, Edit, x+2 yp-3 w196 vEdtEasyControlClass,
  265. Gui, 1:Add, Text, x5 y+5, Control Text
  266. Gui, 1:Add, Edit, x+2 yp-3 w216 vEdtEasyControlText,
  267. Gui, 1:Add, Text, x5 y+5, Mouse Position relative to Window
  268. Gui, 1:Add, Edit, x+2 yp-3 w110 vEdtEasyMousePosWin,
  269. Gui, 1:Tab, Advanced
  270. Gui, 1:Add, Text, x5 y28 Section, Pos. rel. to Window
  271. Gui, 1:Add, Edit, x+2 yp-3 w80 vEdtDataMousePosWin,
  272. Gui, 1:Add, Button, x+28 yp-1 vBtnShowList gBtnShowList -Wrap, % iif(ChkShowList,"<< Less Info","More Info >>")
  273. Gui, 1:Font, bold
  274. Gui, 1:Add, GroupBox, xs w274 h114 -wrap, Control
  275. Gui, 1:Font, normal
  276. Gui, 1:Add, Text, xs+4 yp+18, Text
  277. Gui, 1:Add, Edit, x+2 yp-3 w104 vEdtControlText,
  278. Gui, 1:Add, Text, x+5 yp+3, ClassNN
  279. Gui, 1:Add, Edit, x+2 yp-3 w91 vEdtControlClass,
  280. Gui, 1:Add, Text, xs+4 y+5, Pos
  281. Gui, 1:Add, Edit, x+2 yp-3 w60 vEdtControlPos,
  282. Gui, 1:Add, Text, x+5 yp+3, Size
  283. Gui, 1:Add, Edit, x+2 yp-3 w65 vEdtControlSize,
  284. Gui, 1:Add, Text, x+5 yp+3, Hwnd
  285. Gui, 1:Add, Edit, x+2 yp-3 w59 vEdtControlHwnd,
  286. Gui, 1:Add, Text, xs+4 y+3, List`nItems
  287. Gui, 1:Add, Edit, x+4 r3 w237 vEdtListItems,
  288. Gui, 1:Font, bold
  289. Gui, 1:Add, GroupBox, xs w274 h492 -wrap vGrbAdvancedWindow, Window
  290. Gui, 1:Font, normal
  291. Gui, 1:Add, Text, xs+4 yp+18 , Title
  292. Gui, 1:Add, Edit, x+2 yp-3 w244 vEdtWindowTitle,
  293. Gui, 1:Add, Text, xs+4 y+5, Position
  294. Gui, 1:Add, Edit, x+2 yp-3 w88 vEdtWindowPos,
  295. Gui, 1:Add, Text, x+5 yp+3, Size
  296. Gui, 1:Add, Edit, x+2 yp-3 w112 vEdtWindowSize,
  297. Gui, 1:Add, Text, xs+4 y+5, Class
  298. Gui, 1:Add, Edit, x+2 yp-3 w100 vEdtWindowClass,
  299. Gui, 1:Add, Text, x+5 yp+3, Process
  300. Gui, 1:Add, Edit, x+2 yp-3 w94 vEdtWindowProcess,
  301. Gui, 1:Add, Text, xs+4 y+5, Unique ID
  302. Gui, 1:Add, Edit, x+2 yp-3 w77 vEdtWindowUID,
  303. Gui, 1:Add, Text, x+5 yp+3, Process ID
  304. Gui, 1:Add, Edit, x+2 yp-3 w80 vEdtWindowPID,
  305. Gui, 1:Add, Text, xs+4 y+3, StatusbarText (Part# - Text)
  306. Gui, 1:Add, ListBox, xs+4 y+2 r4 w266 vLsbStatusbarText,
  307. Gui, 1:Add, Text, xs+4 y+3 Section, Fast Visible Text
  308. Gui, 1:Add, Edit, y+2 r10 w132 vEdtWindowTextFastVisible,
  309. Gui, 1:Add, Text, x+2 ys, Fast Hidden Text
  310. Gui, 1:Add, Edit, y+2 r10 w132 vEdtWindowTextFastHidden,
  311. Gui, 1:Add, Text, xs Section vTxtWindowTextSlowVisible, Slow Visible Text
  312. Gui, 1:Add, Edit, y+2 r10 w132 vEdtWindowTextSlowVisible,
  313. Gui, 1:Add, Text, x+2 ys vTxtWindowTextSlowHidden, Slow Hidden Text
  314. Gui, 1:Add, Edit, y+2 r10 w132 vEdtWindowTextSlowHidden,
  315. Gui, 1:Tab, Mouse
  316. Gui, 1:Add, Text, x5 y28, Data of/under mouse cursor and Positions relative to
  317. Gui, 1:Add, Text, x5 y+5, Window
  318. Gui, 1:Add, Edit, x+2 yp-3 w106 vEdtMousePosWin,
  319. Gui, 1:Add, Text, x+5 yp+3, Screen
  320. Gui, 1:Add, Edit, x+2 yp-3 w88 vEdtMousePosScreen,
  321. Gui, 1:Add, Text, x5 y+5, Active Window
  322. Gui, 1:Add, Edit, x+2 yp-3 w73 vEdtMousePosAWin,
  323. Gui, 1:Add, Text, x+5 yp+3, Cursor
  324. Gui, 1:Add, Edit, x+2 yp-3 w92 vEdtMousePointer,
  325. Gui, 1:Add, Text, x5 y+5, RGB Color
  326. Gui, 1:Add, Edit, x+2 yp-3 w95 vEdtMouseColorRGB,
  327. Gui, 1:Add, Text, x+5 yp+3, RGB Color
  328. Gui, 1:Add, Edit, x+2 yp-3 w72 vEdtMouseColorHex,
  329. Gui, 1:Font, bold
  330. Gui, 1:Add, GroupBox, x5 y+10 Section w274 h305 -wrap, Color Picker
  331. Gui, 1:Font, normal
  332. Gui, 1:Add, Text, xs+4 yp+18, Dimension:
  333. Gui, 1:Add, ComboBox, x+5 yp-3 w55 vCbbColorPickDim gRefreshControlStates, 1x1|3x3||5x5|7x7|9x9|15x15
  334. Gui, 1:Add, Radio, x+5 yp+3 vRadColorPick gRefreshControlStates, RGB
  335. Gui, 1:Add, Radio, x+5 Checked gRefreshControlStates, BGR
  336. Gui, 1:Add, Text, xs+4 y+5 w10 h5 Section, ;only to create a gap to the color matix
  337. Loop, 15 {
  338. Row = %A_Index%
  339. dy := (Row = 8 OR Row = 9) ? "y+2" : ""
  340. Gui, 1:Add, Progress, xs+5 %dy% w17 h17 vPgbColorPicker%Row%_1,
  341. Loop, 14 {
  342. Column := A_Index + 1
  343. dx := (A_Index = 7 OR A_Index = 8) ? 2 : 0
  344. Gui, 1:Add, Progress, x+%dx% w17 h17 vPgbColorPicker%Row%_%Column%,
  345. }
  346. }
  347. Gui, 1:Tab, Options
  348. Gui, 1:Add, Text, x5 y25 Section , Show window and control data for
  349. Gui, 1:Add, Radio, xs y+5 vRadWindow gRefreshControlStates, Active Window
  350. Gui, 1:Add, Radio, xs y+5 Checked gRefreshControlStates, Window under Mouse Cursor
  351. Gui, 1:Add, Button, x+55 y25 gBtnShowOptions1, Advanced`nOptions
  352. Gui, 1:Add, Text, xs y+25, Show control data for
  353. Gui, 1:Add, Radio, xs y+5 vRadControl gRefreshControlStates, Focused Control in Window
  354. Gui, 1:Add, Radio, xs y+5 Checked gRefreshControlStates, Control under Mouse Cursor
  355. Gui, 1:Add, Checkbox, xs y+15 vChkTtpMaster gRefreshControlStates Checked%ChkTtpMaster%, Show tooltip at cursor
  356. Gui, 1:Add, Button, x+3 yp-5 gBtnShowOptions2, Data Filter Options
  357. Gui, 1:Add, Text, xs y+12 , Draw a rectangle around
  358. Gui, 1:Add, Checkbox, x+5 vChkDrawRectCtrl gChkDrawRectCtrl Checked%ChkDrawRectCtrl%, control (red)
  359. Gui, 1:Add, Checkbox, y+5 vChkDrawRectWin gChkDrawRectWin Checked%ChkDrawRectWin%, window (green)
  360. ExportOptions = ;collect all checkboxes, so they can be parsed in a loop
  361. (LTrim Join,
  362. ChkExportMousePosScreen,ChkExportMousePosAWin,ChkExportMousePosWin
  363. ChkExportMousePointer,ChkExportMouseColorRGB,ChkExportMouseColorHex
  364. ChkExportCtrlText,ChkExportCtrlClass,ChkExportCtrlPos
  365. ChkExportCtrlSize,ChkExportCtrlListItems,ChkExportWinTitle,ChkExportWinPos
  366. ChkExportWinSize,ChkExportWinClass,ChkExportWinProcess
  367. ChkExportWinUID,ChkExportWinPID,ChkExportWinStatusText
  368. ChkExportWinText,ChkExportLargeList
  369. )
  370. Gui, 1:Add, Text, xs y+17 ,Log Data to File
  371. Gui, 1:Add, Button, x+5 yp-5 gBtnShowOptions3, Log Options
  372. Gui, 1:Add, Button, x+5 vBtnSaveExport gBtnSaveExport, Save to file
  373. Gui, 1:Add, Edit, xs w255 vEdtExportFile, %EdtExportFile%
  374. Gui, 1:Add, Button, x+2 yp-1 gBtnBrowseExportFile,...
  375. Gui, 1:Tab, Info
  376. Gui, 1:Add, Text, x5 y25 Section ,
  377. (
  378. This GUI will reveal information on windows, controls, etc.,
  379. but only when this GUI is not the active window.
  380. - To start/stop updating data press the Auto-Update
  381. toggle Hotkey (default: Pause).
  382. - To put the content of a field on the clipboard click with
  383. the left mouse button into the field.
  384. - To toggle the always-on-top state of this GUI use the
  385. middle mouse button.
  386. )
  387. Gui, 1:Add, Button, x70 y+5 vBtnShowInfo gBtnShowInfo, More Information - Please read
  388. Gui, 1:Tab
  389. GuiControl, Choose, Tab1, %Tab1%
  390. Gui, 1:Add, Radio, x290 y2 Section vRadList1 gRadList, Info on all Controls of one window
  391. Gui, 1:Add, Radio, x+5 vRadList2 gRadList, Info on all Windows (Click radio buttons again to refresh list)
  392. Gui, 1:Add, ListView, xs y+5 w370 h339 vLV1 Count200
  393. , Z or Stack Order|Unique ID or Handle|Window PID|Class(NN)|Process Name|Hidden|Title or Text|X|Y|Width|Height|Style|ExStyle|Selected|CurrentCol|CurrentLine|LineCount|Choice|Tab|Enabled|Checked
  394. ;Apply settings
  395. If RadWindow = 1
  396. GuiControl, 1:, RadWindow, 1
  397. If RadControl = 1
  398. GuiControl, 1:, RadControl, 1
  399. If RadColorPick = 1
  400. GuiControl, 1:, RadColorPick, 1
  401. GuiControl, 1:, RadList%SelectedRadList%, 1
  402. GuiControl, 1:ChooseString, CbbColorPickDim, %CbbColorPickDim%
  403. StringSplit, Dim, CbbColorPickDim, x ;prepare color picker dimensions
  404. Dim = %Dim1%
  405. HalfDim := Dim // 2 + 1
  406. GoSub, ShowHideList
  407. If Gui1AOTState {
  408. Gui, 1:+AlwaysOnTop
  409. TitleExtension = - *AOT*
  410. }
  411. If ChkHideGui
  412. ShowOption = Hide
  413. Else
  414. ShowOption = NoActivate
  415. Gui, 1:Show, %Gui1Pos% %ShowOption% AutoSize , %ScriptName% %TitleExtension%
  416. If !ChkHideGui
  417. GuiIsVisible := True
  418. Return
  419. ;###############################################################################
  420. ;### prepare hotkey or mouse interaction with GUI ##########################
  421. ;###############################################################################
  422. WM_LBUTTONDOWN(wParam, lParam, msg, hwnd){ ;Copy-On-Click for controls
  423. global
  424. local Content
  425. If A_GuiControl is space ;Control is not known
  426. Return
  427. If A_GuiControl not contains Edt,Lsb,Pgb ;Control is something else then edit, listbox or progressbar control
  428. Return
  429. ;Check for full text vars
  430. Fulltext = %A_GuiControl%Full
  431. If (%Fulltext% <> "")
  432. Content := %Fulltext%
  433. Else {
  434. If A_GuiControl contains Pgb ;get value from color pickers (progressbar)
  435. Content := %A_GuiControl%
  436. Else
  437. GuiControlGet, Content, , %A_GuiControl% ;get controls content
  438. }
  439. If Content is space ;content is empty or couldn't be retrieved
  440. Return
  441. If A_GuiControl contains Class ;change data for specific fields
  442. Content = ahk_class %Content%
  443. Else If A_GuiControl contains UID
  444. Content = ahk_id %Content%
  445. Else If A_GuiControl contains PID
  446. Content = ahk_pid %Content%
  447. Else If A_GuiControl contains Process
  448. Content = ahk_pname %Content%
  449. Else If A_GuiControl contains Pos,Size
  450. {
  451. StringReplace, Content, Content, x
  452. StringReplace, Content, Content, y
  453. StringReplace, Content, Content, w
  454. StringReplace, Content, Content, h
  455. StringReplace, Content, Content, %A_Space%, `,%A_Space%
  456. }
  457. Else If A_GuiControl contains Pgb
  458. Content = 0x%Content%
  459. ClipBoard = %Content% ;put content in clipboard
  460. If ChkShowInfoToolTip {
  461. If (StrLen(Content) > 200){ ;give feedback (limit size to 200 characters)
  462. StringLeft, Content, Content, 200
  463. Content = %Content% ...
  464. }
  465. ToolTip("ClipBoard = " Content)
  466. }
  467. }
  468. WM_ACTIVATE(wParam, lParam, msg, hwnd){
  469. Global UpdateIsStopped, ChkHideGui
  470. If (wParam AND !ChkHideGui)
  471. UpdateIsStopped := False
  472. }
  473. UpdateOnClick:
  474. UpdateIsStopped := False ;needs to be set if large list had set it to true
  475. GoSub, UpdateInfo ;collect data
  476. Return
  477. PauseAction: ;user has pressed toogle auto-update hotkey
  478. If ChkHideGui { ;user wants hide/show toggle
  479. UpdateIsStopped := False ;needs to be set if large list had set it to true
  480. If GuiIsVisible {
  481. Gui, 1:Hide
  482. }Else{
  483. SetTimer, UpdateInfo, Off ;turn timer off, to collect only once data
  484. UpdateIsStopped := False ;turn update on
  485. UpdateAfterPause := True ;set flag to update all
  486. GoSub, UpdateInfo ;collect data
  487. UpdateAfterPause := False ;turn off flag to update all
  488. UpdateIsStopped := True ;turn update off
  489. SetTimer, UpdateInfo, %CbbUpdateInterval% ;turn timer back on
  490. GoSub, GuiShow ;bring GUI to front
  491. }
  492. GuiIsVisible := not GuiIsVisible
  493. If ChkShowInfoToolTip
  494. ToolTip(iif(UpdateIsStopped,"Press " HtkPauseAction " to hide GUI","Wait for " HtkPauseAction " key to`nupdate data and show GUI"),2000)
  495. }Else {
  496. UpdateIsStopped := not UpdateIsStopped ;toggle update status and show feedback
  497. If UpdateIsStopped ;when stopped, bring GUI to front
  498. GoSub, GuiShow
  499. If ChkShowInfoToolTip ;give feedback
  500. ToolTip(Scriptname "`n----------------------------`nUpdate data : " iif(UpdateIsStopped,"Off","On"))
  501. }
  502. GoSub, ToogleExportActions
  503. GoSub, PrepareFrameDraw ;create or destroy frame drawing objects
  504. Return
  505. ToogleExportActions:
  506. ;Disable Export Save button during update
  507. GuiControl, 1:Enable%UpdateIsStopped%, BtnSaveExport
  508. ;Enable Export Save hotkey when update is stopped and hotkey wanted
  509. If (ChkUseSaveHotkey AND UpdateIsStopped)
  510. HotKey, #s, , On
  511. Else ; ... otherwise de-activate Export Save hotkey
  512. HotKey, #s, , Off UseErrorLevel
  513. Return
  514. PrepareFrameDraw: ;create or destroy frame drawing objects
  515. If (UpdateIsStopped OR (ChkDrawRectCtrl = 0 AND ChkDrawRectWin = 0)){
  516. GoSub, CleanUpFrameGui
  517. ;create GUI Only if Gui doesn't exist yet and is needed.
  518. }Else If ( (ChkDrawRectCtrl OR ChkDrawRectWin) And not FrameGUIExists ){
  519. FrameGUIExists := True
  520. ;create transparent GUI covering the whole screen
  521. Gui, 2:+Lastfound +AlwaysOnTop
  522. Gui, 2:Color, Black
  523. WinSet, TransColor, Black
  524. Gui, 2: -Caption +ToolWindow
  525. Gui, 2:Show, x0 y0 w%ScreenWidth% h%ScreenHeight%, FrameDrawGUI2
  526. UniqueIDGui2 := WinExist()
  527. ;create draw objects for that window
  528. CreateDrawHandles(UniqueIDGui2, ScreenWidth, ScreenHeight, frame_cc, frame_cw)
  529. }
  530. ;set previous control/window to nothing, so that the frames start to draw immediatly
  531. PreviousControlID =
  532. PreviousWindowID =
  533. Return
  534. CleanUpFrameGui:
  535. DeleteObject( h_brushC ) ;destroy objects
  536. DeleteObject( h_brushW )
  537. DeleteObject( h_region )
  538. DeleteObject( hbm_buffer )
  539. DeleteDC( hdc_frame )
  540. DeleteDC( hdc_buffer )
  541. Gui, 2:Destroy ;destroy gui
  542. FrameGUIExists := False
  543. ToolTip, , , , 2 ;remove control frame tooltip
  544. ToolTip, , , , 3 ;remove window frame tooltip
  545. Return
  546. ;###############################################################################
  547. ;### Interactions with GUI controls ########################################
  548. ;###############################################################################
  549. Tab1:
  550. GuiControlGet, Tab1, 1: ;get current value
  551. GoSub, ClearNotUsedControls
  552. If (Tab1 = 1){ ;adjust tab height based on visible tab
  553. GuiControl, 1:Move, Tab1, h145
  554. }Else If (Tab1 = 2) {
  555. GuiControl, 1:Move, Tab1, h570
  556. }Else If (Tab1 = 3) {
  557. GuiControl, 1:Move, Tab1, h430
  558. }Else If (Tab1 = 4) {
  559. GuiControl, 1:Move, Tab1, h274
  560. }Else If (Tab1 = 5) {
  561. GuiControl, 1:Move, Tab1, h174
  562. }
  563. ChkShowList := False
  564. GoSub, ShowHideList
  565. Gui, 1:Show, AutoSize ;autosize GUI
  566. return
  567. ClearNotUsedControls:
  568. If (Tab1 <> 2) {
  569. GuiControl, 1:, EdtListItems, >>>not updated<<<
  570. GuiControl, 1:, LsbStatusbarText, |>>>not updated<<<
  571. GuiControl, 1:, EdtWindowTextFastVisible, >>>not updated<<<
  572. GuiControl, 1:, EdtWindowTextSlowVisible, >>>not updated<<<
  573. GuiControl, 1:, EdtWindowTextFastHidden, >>>not updated<<<
  574. GuiControl, 1:, EdtWindowTextSlowHidden, >>>not updated<<<
  575. }
  576. If (Tab1 <> 3) {
  577. Loop, %Dim% {
  578. Row := A_Index + 8 - HalfDim
  579. Loop, %Dim% {
  580. y++
  581. Control := "PgbColorPicker" (A_Index + 8 - HalfDim) "_" Row
  582. GuiControl, 1:+BackgroundECE9D8,%Control%
  583. }
  584. }
  585. }
  586. Return
  587. ShowHideList:
  588. GuiControl, 1:, BtnShowList, % iif(ChkShowList,"<< Less Info","More Info >>")
  589. GuiControl, 1:Show%ChkShowList%, RadList1 ;show/hide controls
  590. GuiControl, 1:Show%ChkShowList%, RadList2
  591. GuiControl, 1:Show%ChkShowList%, LV1 ;show/hide large list
  592. Return
  593. BtnShowList:
  594. ChkShowList := not ChkShowList
  595. GoSub, ShowHideList
  596. Gui, 1:Show, AutoSize ;autosize GUI
  597. If ChkShowList
  598. GoSub, GetDataForLargeList ;get data
  599. Return
  600. RadList:
  601. LV_Delete() ;clear controls
  602. StringRight, SelectedRadList, A_GuiControl, 1 ;get which got pressed
  603. Loop, 2 ;deactivate the other
  604. If (A_Index <> SelectedRadList)
  605. GuiControl, 1:, RadList%A_Index%, 0
  606. Gui, 1:Submit, NoHide
  607. GoSub, GetDataForLargeList ;get data
  608. Return
  609. GetDataForLargeList:
  610. If (RadList1 = 1){ ;get data depending on choice
  611. WindowUniqueID = %EdtWindowUID%
  612. If EdtWindowUID is not space
  613. GoSub, GetControlListInfo
  614. }
  615. Else
  616. GoSub, GetAllWindowsInfo
  617. Return
  618. RefreshControlStates:
  619. Gui, 1:Submit, NoHide ;get current values of all controls
  620. StringSplit, Dim, CbbColorPickDim, x ;prepare color picker dimensions
  621. Dim = %Dim1%
  622. HalfDim := Dim // 2 + 1
  623. Loop, 15 {
  624. Row = %A_Index%
  625. Loop, 15
  626. GuiControl, 1:+BackgroundDefault ,PgbColorPicker%Row%_%A_Index%
  627. }
  628. Return
  629. ChkDrawRectCtrl:
  630. GuiControlGet, ChkDrawRectCtrl, 1: ;get current value
  631. GoSub, PrepareFrameDraw
  632. ToolTip, , , , 2
  633. Return
  634. ChkDrawRectWin:
  635. GuiControlGet, ChkDrawRectWin, 1: ;get current value
  636. GoSub, PrepareFrameDraw
  637. ToolTip, , , , 3
  638. Return
  639. ;###############################################################################
  640. ;### GUI actions ###########################################################
  641. ;###############################################################################
  642. GuiSize:
  643. If (A_EventInfo = 0) { ;restored, or resized
  644. GuiControl, 1:Move, Tab1, h%A_GuiHeight%
  645. w := A_GuiWidth - 290
  646. h := A_GuiHeight - 22
  647. GuiControl, 1:Move, LV1, w%w% h%h%
  648. h -= 143
  649. GuiControl, 1:Move, GrbAdvancedWindow, h%h%
  650. h := (h - 218) / 2
  651. GuiControl, 1:Move, EdtWindowTextFastVisible, h%h%
  652. GuiControl, 1:Move, EdtWindowTextFastHidden, h%h%
  653. y := A_GuiHeight - h - 24
  654. GuiControl, 1:Move, TxtWindowTextSlowVisible, y%y%
  655. GuiControl, 1:Move, TxtWindowTextSlowHidden, y%y%
  656. y += 15
  657. GuiControl, 1:Move, EdtWindowTextSlowVisible, y%y% h%h%
  658. GuiControl, 1:Move, EdtWindowTextSlowHidden, y%y% h%h%
  659. If (LastEventInfo = 1){ ;Gui got restored
  660. ;start updating again
  661. UpdateIsStopped := False
  662. ;reactivate frame
  663. GoSub, PrepareFrameDraw
  664. }
  665. }Else If (A_EventInfo = 1) { ;minimized
  666. ;stop updating
  667. UpdateIsStopped := True
  668. ;remove frames
  669. GoSub, PrepareFrameDraw
  670. }
  671. LastEventInfo = %A_EventInfo%
  672. Return
  673. WriteIni:
  674. Gui, 1:Submit, NoHide
  675. WinGetPos, PosX, PosY, SizeW, SizeH, %WinNameGui1%
  676. Loop, 2
  677. If (RadList%A_Index% = 1)
  678. IniWrite, %A_Index% , %IniFile%, Settings, SelectedRadList
  679. If (PosX > -4 and PosY > -4)
  680. IniWrite, x%PosX% y%PosY% , %IniFile%, Settings, Gui1Pos
  681. IniWrite, %Gui1AOTState% , %IniFile%, Settings, Gui1AOTState
  682. IniWrite, %Tab1% , %IniFile%, Settings, Tab1
  683. IniWrite, %RadWindow% , %IniFile%, Settings, RadWindow
  684. IniWrite, %RadControl% , %IniFile%, Settings, RadControl
  685. IniWrite, %ChkShowList% , %IniFile%, Settings, ChkShowList
  686. IniWrite, %HtkPauseAction% , %IniFile%, Settings, HtkPauseAction
  687. IniWrite, %ChkCopyToCB% , %IniFile%, Settings, ChkCopyToCB
  688. IniWrite, %ChkHideGui% , %IniFile%, Settings, ChkHideGui
  689. IniWrite, %ChkUseSaveHotkey% , %IniFile%, Settings, ChkUseSaveHotkey
  690. Loop, Parse, ExportOptions, `,
  691. IniWrite, % %A_LoopField% , %IniFile%, Export , %A_LoopField%
  692. IniWrite, %EdtExportFile% , %IniFile%, Export , EdtExportFile
  693. IniWrite, %ChkExportAutoNumber%, %IniFile%, Export , ChkExportAutoNumber
  694. IniWrite, %ChkExportAppend% , %IniFile%, Export , ChkExportAppend
  695. IniWrite, %ChkShowInfoToolTip% , %IniFile%, Advanced, ChkShowInfoToolTip
  696. IniWrite, %ChkDrawRectCtrl% , %IniFile%, Advanced, ChkDrawRectCtrl
  697. IniWrite, %ChkDrawRectWin% , %IniFile%, Advanced, ChkDrawRectWin
  698. IniWrite, %ChkTtpMaster% , %IniFile%, Advanced, ChkTtpMaster
  699. IniWrite, %ChkTtpMSPos% , %IniFile%, Advanced, ChkTtpMSPos
  700. IniWrite, %ChkTtpMWPos% , %IniFile%, Advanced, ChkTtpMWPos
  701. IniWrite, %ChkTtpMColor% , %IniFile%, Advanced, ChkTtpMColor
  702. IniWrite, %ChkTtpCClass% , %IniFile%, Advanced, ChkTtpCClass
  703. IniWrite, %ChkTtpCPos% , %IniFile%, Advanced, ChkTtpCPos
  704. IniWrite, %ChkTtpCSize% , %IniFile%, Advanced, ChkTtpCSize
  705. IniWrite, %ChkTtpWClass% , %IniFile%, Advanced, ChkTtpWClass
  706. IniWrite, %ChkTtpWTitle% , %IniFile%, Advanced, ChkTtpWTitle
  707. IniWrite, %CbbUpdateInterval% , %IniFile%, Advanced, CbbUpdateInterval
  708. IniWrite, %CbbColorPickDim% , %IniFile%, Advanced, CbbColorPickDim
  709. IniWrite, %RadColorPick% , %IniFile%, Advanced, RadColorPick
  710. IniWrite, %ChkAutoStartUpdate% , %IniFile%, Advanced, ChkAutoStartUpdate
  711. IniWrite, %CbbHtkUpdate% , %IniFile%, Advanced, CbbHtkUpdate
  712. IniWrite, %RadUpdateOnClick% , %IniFile%, Advanced, RadUpdateOnClick
  713. IniWrite, %RadUpdateAuto% , %IniFile%, Advanced, RadUpdateAuto
  714. Return
  715. GuiClose:
  716. GuiEscape:
  717. GoSub, WriteIni
  718. ExitApp
  719. Return
  720. ;###############################################################################
  721. ;### GUI for information text ##############################################
  722. ;###############################################################################
  723. BtnShowInfo:
  724. GuiControl, 1:Disable, BtnShowInfo
  725. Gui, 3:+Owner1 +AlwaysOnTop +ToolWindow +Resize
  726. Gui, 3:Font, s8, MS Sans Serif
  727. Gui, 3:Add, Button, gCloseInfoGui, Close
  728. Gui, 3:Add, Edit, w600 h400 vEdtInfoText, %InformationText%
  729. Gui, 3:Show,, Info - %ScriptName%
  730. Return
  731. 3GuiClose:
  732. 3GuiEscape:
  733. CloseInfoGui:
  734. GuiControl, 1:Enable, BtnShowInfo
  735. Gui, 3:Destroy
  736. Return
  737. 3GuiSize:
  738. w := A_GuiWidth - 20
  739. h := A_GuiHeight - 45
  740. GuiControl, 3:Move, EdtInfoText, w%w% h%h%
  741. Return
  742. ;###############################################################################
  743. ;### GUI for options #######################################################
  744. ;###############################################################################
  745. BtnShowOptions1:
  746. ChangeToTab = 1
  747. GoSub, BtnShowOptions
  748. Return
  749. BtnShowOptions2:
  750. ChangeToTab = 2
  751. GoSub, BtnShowOptions
  752. Return
  753. BtnShowOptions3:
  754. ChangeToTab = 3
  755. GoSub, BtnShowOptions
  756. Return
  757. BtnShowOptions:
  758. UpdateIsStopped := True
  759. Hotkey, IfWinNotActive, ahk_id %Gui1UniqueID%
  760. Hotkey, ~%CbbHtkUpdate%, Off
  761. Hotkey, IfWinNotActive
  762. Gui, 1:+Disabled
  763. Gui, 4:+Owner1 +AlwaysOnTop +ToolWindow
  764. Gui, 4:Font, s8, MS Sans Serif
  765. Gui, 4:Add, Tab, Section w300 h390 vTab2 AltSubmit -Wrap, Advanced|ToolTip|Log to File
  766. Gui, 4:Tab, Advanced
  767. Gui, 4:Add, GroupBox, w275 h73, Update data
  768. Gui, 4:Add, Radio, xp+10 yp+22 Checked%RadUpdateOnClick% vRadUpdateOnClick gRadUpdate, on click with
  769. Gui, 4:Add, ComboBox, x+5 yp-3 w80 vCbbHtkUpdate, LButton|MButton||RButton
  770. Gui, 4:Add, Radio, x32 y+8 Checked%RadUpdateAuto% vRadUpdateAuto gRadUpdate, automatically every milliseconds:
  771. Gui, 4:Add, ComboBox, x+5 yp-3 w50 vCbbUpdateInterval, 100||200|300|400|500|1000|2000
  772. Gui, 4:Add, Checkbox, x22 y+20 vChkChangePauseHotkey gChkChangePauseHotkey, Change hotkey to toogle auto-update (default: Pause)
  773. Gui, 4:Add, Hotkey, xp+15 y+5 w150 vHtkPauseAction gHtkPauseAction Disabled, %HtkPauseAction%
  774. Gui, 4:Add, Checkbox, xp-15 y+5 vChkHideGui Checked%ChkHideGui%, Hide/Show GUI with above hotkey`;`nbefore the GUI is shown data will be collected
  775. Gui, 4:Add, Checkbox, y+5 vChkAutoStartUpdate Checked%ChkAutoStartUpdate%, Start updating of data again when Gui gets inactive`nafter auto-update has been turned off.
  776. Gui, 4:Add, Checkbox, y+5 vChkCopyToCB Checked%ChkCopyToCB%, Copy data to clipboard with left click on data field
  777. Gui, 4:Add, Text, y+20, When update is turned off:
  778. Gui, 4:Add, Checkbox, vChkUseSaveHotkey Checked%ChkUseSaveHotkey%, Use Win+S as hotkey to log data to file
  779. Gui, 4:Add, Checkbox, y+20 Section vChkShowInfoToolTip Checked%ChkShowInfoToolTip%, Show info-tooltips
  780. Gui, 4:Tab, ToolTip
  781. Gui, 4:Add, Text, , Check which data you want to see next to the mouse cursor
  782. Gui, 4:Add, Checkbox, vChkTtpMSPos Checked%ChkTtpMSPos%, Mouse position on screen *
  783. Gui, 4:Add, Checkbox, vChkTtpMWPos Checked%ChkTtpMWPos%, Mouse position on window
  784. Gui, 4:Add, Checkbox, vChkTtpMColor Checked%ChkTtpMColor%, Color under mouse pointer
  785. Gui, 4:Add, Checkbox, vChkTtpCClass Checked%ChkTtpCClass%, Control class under mouse pointer *
  786. Gui, 4:Add, Checkbox, vChkTtpCPos Checked%ChkTtpCPos%, Control position
  787. Gui, 4:Add, Checkbox, vChkTtpCSize Checked%ChkTtpCSize%, Control size
  788. Gui, 4:Add, Checkbox, vChkTtpWClass Checked%ChkTtpWClass%, Window class *
  789. Gui, 4:Add, Checkbox, vChkTtpWTitle Checked%ChkTtpWTitle%, Window title *
  790. Gui, 4:Add, Text, , (* = available when Gui is hidden)
  791. Gui, 4:Tab, Log to File
  792. Gui, 4:Add, GroupBox, Section w274 h70 , Log this Mouse Data
  793. Gui, 4:Add, Checkbox, vChkExportMousePosScreen Checked%ChkExportMousePosScreen% xs+4 yp+18, Position on Screen
  794. Gui, 4:Add, Checkbox, vChkExportMousePosAWin Checked%ChkExportMousePosAWin% xs+125 yp, Pos. rel. to active Window
  795. Gui, 4:Add, Checkbox, vChkExportMousePosWin Checked%ChkExportMousePosWin% xs+4 y+5, Pos. rel. to Window
  796. Gui, 4:Add, Checkbox, vChkExportMousePointer Checked%ChkExportMousePointer% xs+125 yp, Cursor Style
  797. Gui, 4:Add, Checkbox, vChkExportMouseColorRGB Checked%ChkExportMouseColorRGB% xs+4 y+5, RGB Color
  798. Gui, 4:Add, Checkbox, vChkExportMouseColorHex Checked%ChkExportMouseColorHex% xs+125 yp, Hex Color
  799. Gui, 4:Add, GroupBox, xs w274 h75 , Log this Control Data
  800. Gui, 4:Add, Checkbox, vChkExportCtrlText Checked%ChkExportCtrlText% xs+4 yp+18, Control Text
  801. Gui, 4:Add, Checkbox, vChkExportCtrlClass Checked%ChkExportCtrlClass% xs+125 yp, Control ClassNN
  802. Gui, 4:Add, Checkbox, vChkExportCtrlPos Checked%ChkExportCtrlPos% xs+4 y+5, Control Position
  803. Gui, 4:Add, Checkbox, vChkExportCtrlSize Checked%ChkExportCtrlSize% xs+125 yp, Control Size
  804. Gui, 4:Add, Checkbox, vChkExportCtrlListItems Checked%ChkExportCtrlListItems% xs+4 y+5, Control List Items
  805. Gui, 4:Add, GroupBox, xs w274 h110 , Log this Window Data
  806. Gui, 4:Add, Checkbox, vChkExportWinTitle Checked%ChkExportWinTitle% xs+4 yp+18, Window Title
  807. Gui, 4:Add, Checkbox, vChkExportWinPos Checked%ChkExportWinPos% xs+4 y+5, Window Position
  808. Gui, 4:Add, Checkbox, vChkExportWinSize Checked%ChkExportWinSize% xs+125 yp, Window Size
  809. Gui, 4:Add, Checkbox, vChkExportWinClass Checked%ChkExportWinClass% xs+4 y+5, Window Class
  810. Gui, 4:Add, Checkbox, vChkExportWinProcess Checked%ChkExportWinProcess% xs+125 yp, Window Process
  811. Gui, 4:Add, Checkbox, vChkExportWinUID Checked%ChkExportWinUID% xs+4 y+5, Window Unique ID
  812. Gui, 4:Add, Checkbox, vChkExportWinPID Checked%ChkExportWinPID% xs+125 yp, Win Process ID
  813. Gui, 4:Add, Checkbox, vChkExportWinStatusText Checked%ChkExportWinStatusText% xs+4 y+5, Statusbar Text
  814. Gui, 4:Add, Checkbox, vChkExportWinText Checked%ChkExportWinText% xs+125 yp, Window Text
  815. Gui, 4:Add, Checkbox, xs y+16 vChkExportLargeList Checked%ChkExportLargeList%, Log Large List Check:
  816. Gui, 4:Add, Button, x+2 yp-5 gBtnExportCheckAll, All
  817. Gui, 4:Add, Button, x+2 gBtnExportCheckNone , None
  818. Gui, 4:Add, Button, x+2 gBtnExportCheckReverse , Rev
  819. Gui, 4:Add, Text, xs y+5, Additional log options:
  820. Gui, 4:Add, Checkbox, y+5 Section vChkExportAutoNumber gChkExportAutoNumber Checked%ChkExportAutoNumber%, Replace "#" in filename with Numbers
  821. Gui, 4:Add, Checkbox, y+5 vChkExportAppend gChkExportAppend Checked%ChkExportAppend%, Append data to file
  822. Gui, 4:Tab
  823. Gui, 4:Add, Button, xm gApplyOptions, Apply Options
  824. Gui, 4:Add, Button, x+5 g4GuiClose, Cancel
  825. If RadUpdateOnClick {
  826. GuiControl, 4:Disable, ChkChangePauseHotkey
  827. GuiControl, 4:Disable, ChkHideGui
  828. GuiControl, 4:Disable, ChkAutoStartUpdate
  829. }
  830. GuiControl, 4:ChooseString, CbbHtkUpdate, %CbbHtkUpdate%
  831. GuiControl, 4:ChooseString, CbbUpdateInterval, %CbbUpdateInterval%
  832. GoSub, ChkExportAutoNumber
  833. GoSub, ChkExportAppend
  834. GuiControl, 4:Choose, Tab2, %ChangeToTab%
  835. Gui, 4:Show,, Options - %ScriptName%
  836. Return
  837. RadUpdate:
  838. If (A_GuiControl = "RadUpdateOnClick"){
  839. GuiControl, 4:, RadUpdateAuto, 0
  840. GuiControl, 4:, ChkChangePauseHotkey, 0
  841. GuiControl, 4:Disable, ChkChangePauseHotkey
  842. GuiControl, 4:Disable, HtkPauseAction
  843. GuiControl, 4:, ChkHideGui, 0
  844. GuiControl, 4:Disable, ChkHideGui
  845. GuiControl, 4:, ChkAutoStartUpdate, 0
  846. GuiControl, 4:Disable, ChkAutoStartUpdate
  847. }Else{
  848. GuiControl, 4:, RadUpdateOnClick, 0
  849. GuiControl, 4:Enable, ChkChangePauseHotkey
  850. GuiControl, 4:Enable, ChkHideGui
  851. GuiControl, 4:Enable, ChkAutoStartUpdate
  852. GuiControl, 4:, ChkAutoStartUpdate, 1
  853. }
  854. Return
  855. ApplyOptions:
  856. Gui, 4:Submit
  857. If ChkCopyToCB
  858. OnMessage( WM_LBUTTONDOWN, "WM_LBUTTONDOWN" ) ;activate copy-on-click
  859. Else
  860. OnMessage( WM_LBUTTONDOWN, "" ) ;deactivate copy-on-click
  861. If ChkAutoStartUpdate
  862. OnMessage(WM_ACTIVATE, "WM_ACTIVATE") ;activate auto-start updating at Gui inactivity
  863. Else
  864. OnMessage(WM_ACTIVATE, "" ) ;deactivate auto-start updating
  865. If RadUpdateAuto {
  866. SetTimer, UpdateInfo, %CbbUpdateInterval%
  867. }Else{
  868. SetTimer, UpdateInfo, Off
  869. Hotkey, IfWinNotActive, ahk_id %Gui1UniqueID%
  870. Hotkey, ~%CbbHtkUpdate%, UpdateOnClick, On
  871. Hotkey, IfWinNotActive
  872. }
  873. GoSub, PauseAction
  874. 4GuiClose:
  875. 4GuiEscape:
  876. UpdateIsStopped := False
  877. Gui, 1:-Disabled
  878. Gui, 4:Destroy
  879. Return
  880. ChkChangePauseHotkey:
  881. GuiControlGet, ChkChangePauseHotkey, 4: ;get current value
  882. If ChkChangePauseHotkey {
  883. ;de-activate current auto-update toggle hotkey
  884. HotKey, %HtkPauseAction%, Off
  885. GuiControl, 4:Enable, HtkPauseAction
  886. }Else
  887. GoSub, HtkPauseAction
  888. Return
  889. HtkPauseAction:
  890. GuiControlGet, HtkPauseAction, 4: ;get current value
  891. If HtkPauseAction {
  892. If HtkPauseAction in ^,+,! ;don't react on simple modifiers
  893. return
  894. ;activate new auto-update toggle hotkey
  895. HotKey, %HtkPauseAction%, PauseAction, On
  896. GuiControl, 4:Disable, HtkPauseAction
  897. GuiControl, 4:, ChkChangePauseHotkey, 0
  898. }Else{
  899. GuiControl, 4:, ChkChangePauseHotkey, 1
  900. GuiControl, 4:Enable, HtkPauseAction
  901. ToolTip("You need to specify a hotkey", 2000)
  902. }
  903. Return
  904. BtnExportCheckAll:
  905. Loop, Parse, ExportOptions, `,
  906. GuiControl, 4:, %A_LoopField%, 1
  907. Return
  908. BtnExportCheckNone:
  909. Loop, Parse, ExportOptions, `,
  910. GuiControl, 4:, %A_LoopField%, 0
  911. Return
  912. BtnExportCheckReverse:
  913. Gui, 1:Submit, NoHide
  914. Loop, Parse, ExportOptions, `,
  915. GuiControl, 4:, %A_LoopField%, % not %A_LoopField%
  916. Return
  917. ChkExportAutoNumber:
  918. Gui, 4:Submit, NoHide
  919. If ChkExportAutoNumber
  920. GuiControl, 4:Disable, ChkExportAppend
  921. Else
  922. GuiControl, 4:Enable, ChkExportAppend
  923. Return
  924. ChkExportAppend:
  925. Gui, 4:Submit, NoHide
  926. If ChkExportAppend
  927. GuiControl, 4:Disable, ChkExportAutoNumber
  928. Else
  929. GuiControl, 4:Enable, ChkExportAutoNumber
  930. Return
  931. ;###############################################################################
  932. ;### getting the data #####################################################
  933. ;###############################################################################
  934. UpdateInfo:
  935. If UpdateIsStopped
  936. Return
  937. If (WinActive("A") = Gui1UniqueID ) ;don't update when window becomes the active one
  938. Return
  939. If (Tab1 > 3 ) ;don't update when tab 4 or tab 5 are visible
  940. Return
  941. SetBatchLines, -1
  942. ;get mouse pos and make sure mouse is not on frames or tooltips or on it's own gui
  943. MouseIsOnFrameGUI := False
  944. GoSub,…