Rajat
Joined: 28 Mar 2004 Posts: 1717
|
Posted: Tue Apr 13, 2004 8:13 am Post subject: Window Spy with configurable hotkey |
|
|
not many ppl know that the window spy from Au3 has hotkey support (ctrl+alt+f) to freeze current info. till now AHK's window spy doesn't have it so it gets difficult to freeze some info in it.
here's a script which has the hotkey Win+q and has the following advanages:
-The info is shown in an editor so can be saved easily by just pressing ctrl+s
(saved to file MyWinSpy.txt in script's folder)
-The mouse position is shown both relative to window and relative to screen.
-The window remains minimized and doesn't hide screen.
-The info changes only when Win+q is pressed and not when u're trying to select something from the window or switching windows.
here's a disadvantage that i notice:
-The currently selected control is shown, instead of the control under mouse.
(remember to alter control as per OS, details in script)
| Code: | DetectHiddenWindows, On
DetectHiddenText, On
SetWindelay, 1
Setkeydelay, 0
setbatchlines,10ms
;Configure editor & control here (notepad doesn't like my script ;)
;For windows 98 the control is RICHEDIT20A1
;For windows XP the control is RICHEDIT50W1
SetEnv, Editor, write
SetEnv, EditControl, RICHEDIT50W1
FileDelete, %a_scriptdir%\MyWinSpy.txt
FileAppend, `n, %a_scriptdir%\MyWinSpy.txt
IfWinnotexist,MyWinSpy.txt,,run, %editor% "%a_scriptdir%\MyWinSpy.txt",,min
WinWait, MyWinSpy.txt
#q::
WinGetActiveStats, Title, wW, wH, wX, wY
WinGetText, text, %title%
MouseGetPos, wmX, wmY
PixelGetColor, pix, %wmX%, %wmY%
ControlGetFocus, Control,%title%
StatusBarGetText, SBar,,%title%
SetEnv, dmX, %wmX%
SetEnv, dmY, %wmY%
Envadd, dmX, %wX%
Envadd, dmY, %wY%
IfWinnotexist,MyWinSpy.txt,,run, %editor% "%a_scriptdir%\MyWinSpy.txt",,min
WinWait, MyWinSpy.txt
Setenv, Info,
Setenv, Info, %Info%----------[Window Title]----------`n%title%`n`n
Setenv, Info, %Info%----------[Window Text]-----------`n%text%`n`n
Setenv, Info, %Info%--------[Window Position]---------`nleft: %wX% top: %wY% width: %wW% height: %wH%`n`n
Setenv, Info, %Info%---------[Mouse Position]---------`nRelative to Window X: %wmX% Y: %wmY%`n`nRelative to Screen X: %dmX% Y: %dmY%`n`n
Setenv, Info, %Info%----------[Pixel Color]-----------`n%pix%`n`n
Setenv, Info, %Info%--------[Status Bar Text]---------`n%SBar%`n`n
Setenv, Info, %Info%-------[Selected Control]---------`n%control%`n`n
ControlSetText, %EditControl%,%info%, MyWinSpy.txt
return |
_________________
 |
|