Replace AU3_Spy.exe with script Topic is solved

Propose new features and changes
User avatar
fincs
Posts: 500
Joined: 30 Sep 2013, 14:17
GitHub: fincs
Location: Seville, Spain
Contact:

Replace AU3_Spy.exe with script

Post by fincs » 01 Feb 2014, 15:47

AU3_Spy.exe is severely outdated, doesn't support Unicode, uses different text retrieval mechanisms than AutoHotkey itself (which is very misleading), doesn't support the Client coordinate mode, is not DPI-aware and may be an AutoIt3-related copyright infringement. So I propose replacing it with an enhanced and scripted rewrite. SciTE4AutoHotkey already ships with such a script.
fincs
Windows 10 x64 Build 17134 / AutoHotkey v1.1.29.01
Get SciTE4AutoHotkey v3.0.06.01 - [My project list]
User avatar
Blackholyman
Posts: 1271
Joined: 29 Sep 2013, 22:57
Facebook: socialjsz
Google: +Jszapp
Location: Denmark
Contact:

Re: Replace AU3_Spy.exe with script

Post by Blackholyman » 01 Feb 2014, 16:07

+1 ( if there is no loss of info )
Also check out:
[hr][/hr]The Monthly AutoHotkey Webinars

My Autohotkey Blog
:dance: [hr][/hr]
lexikos
Posts: 6176
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: Replace AU3_Spy.exe with script

Post by lexikos » 01 Feb 2014, 16:59

I see one minor problem with that script: when I use it on SciTE itself, I have to scroll to see the class name... (long titles wrap, and the box only shows two lines).
User avatar
fincs
Posts: 500
Joined: 30 Sep 2013, 14:17
GitHub: fincs
Location: Seville, Spain
Contact:

Re: Replace AU3_Spy.exe with script

Post by fincs » 01 Feb 2014, 17:03

The window class info could be displayed before the window title.
fincs
Windows 10 x64 Build 17134 / AutoHotkey v1.1.29.01
Get SciTE4AutoHotkey v3.0.06.01 - [My project list]
vasili111
Posts: 747
Joined: 21 Jan 2014, 02:04
Location: Georgia

Re: Replace AU3_Spy.exe with script

Post by vasili111 » 01 Feb 2014, 17:14

Very good idea :)
DRAKON-AutoHotkey: Visual programming for AutoHotkey.
lexikos
Posts: 6176
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: Replace AU3_Spy.exe with script

Post by lexikos » 02 Feb 2014, 04:24

That's a bit unconventional. You can't put them in that order when you write a script. You could put them in separate fields, or just disable line wrapping.
ahk7
Posts: 110
Joined: 06 Nov 2013, 16:35

Re: Replace AU3_Spy.exe with script

Post by ahk7 » 02 Feb 2014, 07:10

Alternative combining three scripts:
- Active Window Info + added ahk_exe (process)
- Scrollable Gui (Lexikos)
- Resizable Controls using Anchor (p + someone else for 64bit/unicode)
- perhaps adding a copy button per "type" so you don't have to select/copy it manually?
- More extensive version would be AHK Window Info 1.7 by toralt http://www.autohotkey.com/board/topic/8 ... w-info-17/ but the mouse tab works very slow under win8 (perhaps because of the progress controls it uses?)

Code: Select all

;
; Active Window Info
;

#NoEnv
#NoTrayIcon
#SingleInstance Ignore
SetWorkingDir, %A_ScriptDir%
SetBatchLines, -1
CoordMode, Pixel, Screen

; http://www.autohotkey.com/board/topic/26033-scrollable-gui-proof-of-concept/#entry168174
OnMessage(0x115, "OnScroll") ; WM_VSCROLL
OnMessage(0x114, "OnScroll") ; WM_HSCROLL

IfExist, ..\toolicon.icl ; Seems useful enough to support standalone operation.
	Menu, Tray, Icon, ..\toolicon.icl, 9

VarSetCapacity(rect, 16)
isUpd := true
txtNotFrozen := "(Win+A to freeze display)"
txtFrozen := "(Win+A to unfreeze display)"

Gui, New, hwndhGui AlwaysOnTop
Gui, +Resize +0x300000 ; WS_VSCROLL | WS_HSCROLL
Gui, Add, Text,, Window Title, Class and process:
Gui, Add, Edit, w320 r3 ReadOnly vCtrl_Title
Gui, Add, Text,, Mouse Position:
Gui, Add, Edit, w320 r3 ReadOnly vCtrl_MousePos
Gui, Add, Text,, Control Under Mouse Position:
Gui, Add, Edit, w320 r3 ReadOnly vCtrl_MouseCur
Gui, Add, Text,, Active Window Position:
Gui, Add, Edit, w320 r2 ReadOnly vCtrl_Pos
Gui, Add, Text,, Status Bar Text:
Gui, Add, Edit, w320 r2 ReadOnly vCtrl_SBText
Gui, Add, Checkbox, vCtrl_IsSlow, Slow TitleMatchMode
Gui, Add, Text,, Visible Text:
Gui, Add, Edit, w320 r3 ReadOnly vCtrl_VisText
Gui, Add, Text,, All Text:
Gui, Add, Edit, w320 r3 ReadOnly vCtrl_AllText
Gui, Add, Text, w320 r1 vCtrl_Freeze, % txtNotFrozen
Gui, Show, AutoSize, Active Window Info
SetTimer, Update, 250
return

Update:
Gui %hGui%:Default
curWin := WinExist("A")
if (curWin = hGui)
	return
WinGetTitle, t1
WinGetClass, t2
WinGet, t3, ProcessName, A
GuiControl,, Ctrl_Title, % t1 "`nahk_class " t2 "`nahk_exe " t3
CoordMode, Mouse, Screen
MouseGetPos, msX, msY, msWin, msCtrlHwnd, 2
CoordMode, Mouse, Relative
MouseGetPos, mrX, mrY,, msCtrl
CoordMode, Mouse, Client
MouseGetPos, mcX, mcY
GuiControl,, Ctrl_MousePos, % "Absolute:`t" msX ", " msY " (less often used)`nRelative:`t" mrX ", " mrY " (default)`nClient:`t" mcX ", " mcY " (recommended)"
PixelGetColor, mClr, %msX%, %msY%, RGB
mClr := SubStr(mClr, 3)
mText := "`nColor:`t" mClr " (Red=" SubStr(mClr, 1, 2) " Green=" SubStr(mClr, 3, 2) " Blue=" SubStr(mClr, 5) ")"
if (curWin = msWin)
{
	ControlGetText, ctrlTxt, %msCtrl%
	mText := "ClassNN:`t" msCtrl "`nText:`t" textMangle(ctrlTxt) mText
} else mText := "`n" mText
GuiControl,, Ctrl_MouseCur, % mText
WinGetPos, wX, wY, wW, wH
DllCall("GetClientRect", "ptr", curWin, "ptr", &rect)
wcW := NumGet(rect, 8, "int")
wcH := NumGet(rect, 12, "int")
GuiControl,, Ctrl_Pos, % "x: " wX "`ty: " wY "`tw: " wW "`th: " wH "`nClient:`t`tw: " wcW "`th: " wcH
sbTxt := ""
Loop
{
	StatusBarGetText, ovi, %A_Index%
	if ovi =
		break
	sbTxt .= "(" A_Index "):`t" textMangle(ovi) "`n"
}
StringTrimRight, sbTxt, sbTxt, 1
GuiControl,, Ctrl_SBText, % sbTxt
GuiControlGet, bSlow,, Ctrl_IsSlow
SetTitleMatchMode, % bSlow ? "Slow" : "Fast"
DetectHiddenText, Off
WinGetText, ovVisText
DetectHiddenText, On
WinGetText, ovAllText
GuiControl,, Ctrl_VisText, % ovVisText
GuiControl,, Ctrl_AllText, % ovAllText
return

GuiClose:
ExitApp

GuiSize:
    UpdateScrollBars(A_Gui, A_GuiWidth, A_GuiHeight)

	; Allow Resizing via Anchor:
	Anchor("Ctrl_Title", "w")
	Anchor("Ctrl_MousePos", "w")
	Anchor("Ctrl_MouseCur", "w")
	Anchor("Ctrl_Pos", "w")
	Anchor("Ctrl_SBText", "w")
	Anchor("Ctrl_VisText", "w")
	Anchor("Ctrl_AllText", "w")
	Anchor("Ctrl_Freeze", "w")
return

textMangle(x)
{
	if pos := InStr(x, "`n")
		x := SubStr(x, 1, pos-1), elli := true
	if StrLen(x) > 40
	{
		StringLeft, x, x, 40
		elli := true
	}
	if elli
		x .= " (...)"
	return x
}

#a::
Gui %hGui%:Default
isUpd := !isUpd
SetTimer, Update, % isUpd ? "On" : "Off"
GuiControl,, Ctrl_Freeze, % isUpd ? txtNotFrozen : txtFrozen
return

#IfWinActive ahk_group MyGui
WheelUp::
WheelDown::
+WheelUp::
+WheelDown::
    ; SB_LINEDOWN=1, SB_LINEUP=0, WM_HSCROLL=0x114, WM_VSCROLL=0x115
    OnScroll(InStr(A_ThisHotkey,"Down") ? 1 : 0, 0, GetKeyState("Shift") ? 0x114 : 0x115, WinExist())
return
#IfWinActive

UpdateScrollBars(GuiNum, GuiWidth, GuiHeight)
{
    static SIF_RANGE=0x1, SIF_PAGE=0x2, SIF_DISABLENOSCROLL=0x8, SB_HORZ=0, SB_VERT=1
    
    Gui, %GuiNum%:Default
    Gui, +LastFound
    
    ; Calculate scrolling area.
    Left := Top := 9999
    Right := Bottom := 0
    WinGet, ControlList, ControlList
    Loop, Parse, ControlList, `n
    {
        GuiControlGet, c, Pos, %A_LoopField%
        if (cX < Left)
            Left := cX
        if (cY < Top)
            Top := cY
        if (cX + cW > Right)
            Right := cX + cW
        if (cY + cH > Bottom)
            Bottom := cY + cH
    }
    Left -= 8
    Top -= 8
    Right += 8
    Bottom += 8
    ScrollWidth := Right-Left
    ScrollHeight := Bottom-Top
    
    ; Initialize SCROLLINFO.
    VarSetCapacity(si, 28, 0)
    NumPut(28, si) ; cbSize
    NumPut(SIF_RANGE | SIF_PAGE, si, 4) ; fMask
    
    ; Update horizontal scroll bar.
    NumPut(ScrollWidth, si, 12) ; nMax
    NumPut(GuiWidth, si, 16) ; nPage
    DllCall("SetScrollInfo", "uint", WinExist(), "uint", SB_HORZ, "uint", &si, "int", 1)
    
    ; Update vertical scroll bar.
;     NumPut(SIF_RANGE | SIF_PAGE | SIF_DISABLENOSCROLL, si, 4) ; fMask
    NumPut(ScrollHeight, si, 12) ; nMax
    NumPut(GuiHeight, si, 16) ; nPage
    DllCall("SetScrollInfo", "uint", WinExist(), "uint", SB_VERT, "uint", &si, "int", 1)
    
    if (Left < 0 && Right < GuiWidth)
        x := Abs(Left) > GuiWidth-Right ? GuiWidth-Right : Abs(Left)
    if (Top < 0 && Bottom < GuiHeight)
        y := Abs(Top) > GuiHeight-Bottom ? GuiHeight-Bottom : Abs(Top)
    if (x || y)
        DllCall("ScrollWindow", "uint", WinExist(), "int", x, "int", y, "uint", 0, "uint", 0)
}

OnScroll(wParam, lParam, msg, hwnd)
{
    static SIF_ALL=0x17, SCROLL_STEP=10
    
    bar := msg=0x115 ; SB_HORZ=0, SB_VERT=1
    
    VarSetCapacity(si, 28, 0)
    NumPut(28, si) ; cbSize
    NumPut(SIF_ALL, si, 4) ; fMask
    if !DllCall("GetScrollInfo", "uint", hwnd, "int", bar, "uint", &si)
        return
    
    VarSetCapacity(rect, 16)
    DllCall("GetClientRect", "uint", hwnd, "uint", &rect)
    
    new_pos := NumGet(si, 20) ; nPos
    
    action := wParam & 0xFFFF
    if action = 0 ; SB_LINEUP
        new_pos -= SCROLL_STEP
    else if action = 1 ; SB_LINEDOWN
        new_pos += SCROLL_STEP
    else if action = 2 ; SB_PAGEUP
        new_pos -= NumGet(rect, 12, "int") - SCROLL_STEP
    else if action = 3 ; SB_PAGEDOWN
        new_pos += NumGet(rect, 12, "int") - SCROLL_STEP
    else if (action = 5 || action = 4) ; SB_THUMBTRACK || SB_THUMBPOSITION
        new_pos := wParam>>16
    else if action = 6 ; SB_TOP
        new_pos := NumGet(si, 8, "int") ; nMin
    else if action = 7 ; SB_BOTTOM
        new_pos := NumGet(si, 12, "int") ; nMax
    else
        return
    
    min := NumGet(si, 8, "int") ; nMin
    max := NumGet(si, 12, "int") - NumGet(si, 16) ; nMax-nPage
    new_pos := new_pos > max ? max : new_pos
    new_pos := new_pos < min ? min : new_pos
    
    old_pos := NumGet(si, 20, "int") ; nPos
    
    x := y := 0
    if bar = 0 ; SB_HORZ
        x := old_pos-new_pos
    else
        y := old_pos-new_pos
    ; Scroll contents of window and invalidate uncovered area.
    DllCall("ScrollWindow", "uint", hwnd, "int", x, "int", y, "uint", 0, "uint", 0)
    
    ; Update scroll bar.
    NumPut(new_pos, si, 20, "int") ; nPos
    DllCall("SetScrollInfo", "uint", hwnd, "int", bar, "uint", &si, "int", 1)
}

/*
	Function: Anchor
		Defines how controls should be automatically positioned relative to the new dimensions of a window when resized.

	Parameters:
		cl - a control HWND, associated variable name or ClassNN to operate on
		a - (optional) one or more of the anchors: 'x', 'y', 'w' (width) and 'h' (height),
			optionally followed by a relative factor, e.g. "x h0.5"
		r - (optional) true to redraw controls, recommended for GroupBox and Button types

	Examples:
> "xy" ; bounds a control to the bottom-left edge of the window
> "w0.5" ; any change in the width of the window will resize the width of the control on a 2:1 ratio
> "h" ; similar to above but directrly proportional to height

	Remarks:
		To assume the current window size for the new bounds of a control (i.e. resetting) simply omit the second and third parameters.
		However if the control had been created with DllCall() and has its own parent window,
			the container AutoHotkey created GUI must be made default with the +LastFound option prior to the call.
		For a complete example see anchor-example.ahk.

	License:
		- Version 4.60a <http://www.autohotkey.net/~polyethene/#anchor>
		- Dedicated to the public domain (CC0 1.0) <http://creativecommons.org/publicdomain/zero/1.0/>
*/

; Revised version for 64-bit/unicode - author unknown
; http://www.autohotkey.com/board/topic/91997-gui-anchor-for-current-version-of-ahk/?p=580170

Anchor(i, a := "", r := false) {
	static c, cs := 12, cx := 255, cl := 0, g, gs := 8, gl := 0, gpi, gw, gh, z := 0, k := 0xffff, ptr
	if z = 0
		VarSetCapacity(g, gs * 99, 0), VarSetCapacity(c, cs * cx, 0), ptr := A_PtrSize ? "Ptr" : "UInt", z := true
	if !WinExist("ahk_id" . i) {
		GuiControlGet t, Hwnd, %i%
		if ErrorLevel = 0
			i := t
		else ControlGet i, Hwnd,, %i%
	}
	VarSetCapacity(gi, 68, 0), DllCall("GetWindowInfo", "UInt", gp := DllCall("GetParent", "UInt", i), ptr, &gi)
		, giw := NumGet(gi, 28, "Int") - NumGet(gi, 20, "Int"), gih := NumGet(gi, 32, "Int") - NumGet(gi, 24, "Int")
	if (gp != gpi) {
		gpi := gp
		loop %gl%
			if NumGet(g, cb := gs * (A_Index - 1), "UInt") == gp {
				gw := NumGet(g, cb + 4, "Short"), gh := NumGet(g, cb + 6, "Short"), gf := 1
				break
			}
		if !gf
			NumPut(gp, g, gl, "UInt"), NumPut(gw := giw, g, gl + 4, "Short"), NumPut(gh := gih, g, gl + 6, "Short"), gl += gs
	}
	ControlGetPos dx, dy, dw, dh,, ahk_id %i%
	loop %cl%
		if NumGet(c, cb := cs * (A_Index - 1), "UInt") == i {
			if (a = "") {
				cf := 1
				break
			}
			giw -= gw, gih -= gh, as := 1, dx := NumGet(c, cb + 4, "Short"), dy := NumGet(c, cb + 6, "Short")
				, cw := dw, dw := NumGet(c, cb + 8, "Short"), ch := dh, dh := NumGet(c, cb + 10, "Short")
			loop Parse, a, xywh
				if A_Index > 1
					av := SubStr(a, as, 1), as += 1 + StrLen(A_LoopField)
						, d%av% += (InStr("yh", av) ? gih : giw) * (A_LoopField + 0 ? A_LoopField : 1)
			DllCall("SetWindowPos", "UInt", i, "UInt", 0, "Int", dx, "Int", dy
				, "Int", InStr(a, "w") ? dw : cw, "Int", InStr(a, "h") ? dh : ch, "Int", 4)
			if r != 0
				DllCall("RedrawWindow", "UInt", i, "UInt", 0, "UInt", 0, "UInt", 0x0101) ; RDW_UPDATENOW | RDW_INVALIDATE
			return
		}
	if cf != 1
		cb := cl, cl += cs
	bx := NumGet(gi, 48, "UInt"), by := NumGet(gi, 16, "Int") - NumGet(gi, 8, "Int") - gih - NumGet(gi, 52, "UInt")
	if cf = 1
		dw -= giw - gw, dh -= gih - gh
	NumPut(i, c, cb, "UInt"), NumPut(dx - bx, c, cb + 4, "Short"), NumPut(dy - by, c, cb + 6, "Short")
		, NumPut(dw, c, cb + 8, "Short"), NumPut(dh, c, cb + 10, "Short")
	return true
}
User avatar
fincs
Posts: 500
Joined: 30 Sep 2013, 14:17
GitHub: fincs
Location: Seville, Spain
Contact:

Re: Replace AU3_Spy.exe with script

Post by fincs » 02 Feb 2014, 07:12

Alright, I've disabled wrapping.

EDIT: @ahk7: interesting changes (I've already merged the ahk_exe stuff in my working copy). However I fail to see why the gui should be scrollable. Also, it's not necessary to bring in Anchor() for some quick width-related resizing.

EDIT2: Merged ahk7's ahk_exe code (but rewrote the resizing code not to depend on Anchor())..
fincs
Windows 10 x64 Build 17134 / AutoHotkey v1.1.29.01
Get SciTE4AutoHotkey v3.0.06.01 - [My project list]
User avatar
tank
Posts: 2373
Joined: 28 Sep 2013, 22:15
Facebook: charlie.simmons.7334
Google: ttnnkkrr
GitHub: ttnnkkrr
Location: Louisville KY
Contact:

Re: Replace AU3_Spy.exe with script

Post by tank » 02 Feb 2014, 11:01

Awesome
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
https://www.facebook.com/ahkscript.org
If you have forum suggestions please submit a pull request
User avatar
Nextron
Posts: 1218
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win7 x64 AHK: Unicode x32

Re: Replace AU3_Spy.exe with script

Post by Nextron » 05 Feb 2014, 07:55

I really like this 8-) over AU3_Spy.exe due to the fixed positions of data rather than a jumpy blob of data in a single editbox. To include it in my main script, I made some modifications. I don't think it changes anything in the way it works as a stand alone script, but now it can also be easily included in other scripts. To do so I moved the autoexecute section, added some prefixes to the gui-labels, expanded GuiClose:ExitApp with Gui,Destroy && Timer,Off, changed the way the gui icon is set without changing the tray and removed # directives (biggest effective change).

Code: Select all

;Uncomment the next #-lines for a 'prettier' stand alone version
;#NoTrayIcon
;#SingleInstance Ignore
Menu, Tray, NoIcon
AWI_standalone=1
;Assume the lines above don't execute when included in another script

AWI_GuiShow:
	isUpd := true
	txtNotFrozen := "(Win+A to freeze display)"
	txtFrozen := "(Win+A to unfreeze display)"

	Gui, 13:New, LabelAWI_Gui hwndAWI_hGui AlwaysOnTop Resize MinSize
	Gui, Add, Text,, Window Title, Class and Process:
	Gui, Add, Edit, w320 r3 ReadOnly -Wrap vCtrl_Title
	Gui, Add, Text,, Mouse Position:
	Gui, Add, Edit, w320 r3 ReadOnly vCtrl_MousePos
	Gui, Add, Text,, Control Under Mouse Position:
	Gui, Add, Edit, w320 r3 ReadOnly vCtrl_MouseCur
	Gui, Add, Text,, Active Window Position:
	Gui, Add, Edit, w320 r2 ReadOnly vCtrl_Pos
	Gui, Add, Text,, Status Bar Text:
	Gui, Add, Edit, w320 r2 ReadOnly vCtrl_SBText
	Gui, Add, Checkbox, vCtrl_IsSlow, Slow TitleMatchMode
	Gui, Add, Text,, Visible Text:
	Gui, Add, Edit, w320 r2 ReadOnly vCtrl_VisText
	Gui, Add, Text,, All Text:
	Gui, Add, Edit, w320 r2 ReadOnly vCtrl_AllText
	Gui, Add, Text, w320 r1 vCtrl_Freeze, % txtNotFrozen
	IfExist, %A_ScriptDir%\..\toolicon.icl ; Seems useful enough to support standalone operation.
		Loop, 2
			DllCall( "PostMessage", UInt, AWI_hGui, UInt, 0x80, UInt, A_Index-1, UInt, DllCall("LoadImage", uint, DllCall("GetModuleHandle", str, A_ScriptDir . "\..\toolicon.icl"), uint, 9, uint, 1, int, 0, int, 0, uint, 0x40) )
	Else
		Loop, 2
			DllCall( "PostMessage", UInt, AWI_hGui, UInt, 0x80, UInt, A_Index-1, UInt, DllCall("LoadImage", uint, DllCall("GetModuleHandle", str, "shell32.dll"), uint, 281, uint, 1, int, 0, int, 0, uint, 0x40) ) ;Set GUI icon without disturbing tray icon
	Gui, Show,, Active Window Info
	GetClientSize(AWI_hGui, temp)
	horzMargin := temp*96//A_ScreenDPI - 320
	SetTimer, AWI_Update, 250
return

AWI_GuiSize:
	Gui %AWI_hGui%:Default
	if !horzMargin
		return
	ctrlW := A_GuiWidth - horzMargin
	list = Title,MousePos,MouseCur,Pos,SBText,VisText,AllText,Freeze
	Loop, Parse, list, `,
		GuiControl, Move, Ctrl_%A_LoopField%, w%ctrlW%
return

AWI_Update:
	SetBatchLines, -1
	Gui %AWI_hGui%:Default
	curWin := WinExist("A")
	if (curWin = AWI_hGui)
		return
	CoordMode, Pixel, Screen
	WinGetTitle, t1
	WinGetClass, t2
	WinGet, t3, ProcessName
	GuiControl,, Ctrl_Title, % t1 "`nahk_class " t2 "`nahk_exe " t3
	CoordMode, Mouse, Screen
	MouseGetPos, msX, msY, msWin, msCtrlHwnd, 2
	CoordMode, Mouse, Relative
	MouseGetPos, mrX, mrY,, msCtrl
	CoordMode, Mouse, Client
	MouseGetPos, mcX, mcY
	GuiControl,, Ctrl_MousePos, % "Absolute:`t" msX ", " msY " (less often used)`nRelative:`t" mrX ", " mrY " (default)`nClient:`t" mcX ", " mcY " (recommended)"
	PixelGetColor, mClr, %msX%, %msY%, RGB
	mClr := SubStr(mClr, 3)
	mText := "`nColor:`t" mClr " (Red=" SubStr(mClr, 1, 2) " Green=" SubStr(mClr, 3, 2) " Blue=" SubStr(mClr, 5) ")"
	if (curWin = msWin)
	{
		ControlGetText, ctrlTxt, %msCtrl%
		mText := "ClassNN:`t" msCtrl "`nText:`t" textMangle(ctrlTxt) mText
	} else mText := "`n" mText
	GuiControl,, Ctrl_MouseCur, % mText
	WinGetPos, wX, wY, wW, wH
	GetClientSize(curWin, wcW, wcH)
	GuiControl,, Ctrl_Pos, % "x: " wX "`ty: " wY "`tw: " wW "`th: " wH "`nClient:`t`tw: " wcW "`th: " wcH
	sbTxt := ""
	Loop
	{
		StatusBarGetText, ovi, %A_Index%
		if ovi =
			break
		sbTxt .= "(" A_Index "):`t" textMangle(ovi) "`n"
	}
	StringTrimRight, sbTxt, sbTxt, 1
	GuiControl,, Ctrl_SBText, % sbTxt
	GuiControlGet, bSlow,, Ctrl_IsSlow
	SetTitleMatchMode, % bSlow ? "Slow" : "Fast"
	DetectHiddenText, Off
	WinGetText, ovVisText
	DetectHiddenText, On
	WinGetText, ovAllText
	GuiControl,, Ctrl_VisText, % ovVisText
	GuiControl,, Ctrl_AllText, % ovAllText
return

AWI_GuiClose:
	If AWI_standalone
		ExitApp
	isUpd := false
	SetTimer, AWI_Update, Off
	Gui, Destroy
Return

GetClientSize(hWnd, ByRef w := "", ByRef h := "")
{
	VarSetCapacity(rect, 16)
	DllCall("GetClientRect", "ptr", hWnd, "ptr", &rect)
	w := NumGet(rect, 8, "int")
	h := NumGet(rect, 12, "int")
}

textMangle(x)
{
	if pos := InStr(x, "`n")
		x := SubStr(x, 1, pos-1), elli := true
	if StrLen(x) > 40
	{
		StringLeft, x, x, 40
		elli := true
	}
	if elli
		x .= " (...)"
	return x
}

#IfWinExist, Active Window Info
#a::
	Gui %AWI_hGui%:Default
	isUpd := !isUpd
	SetTimer, AWI_Update, % isUpd ? "On" : "Off"
	GuiControl,, Ctrl_Freeze, % isUpd ? txtNotFrozen : txtFrozen
return
#IfWinNotExist, Active Window Info
#a::Goto, AWI_GuiShow
#If,
Zelio
Posts: 275
Joined: 30 Sep 2013, 00:45
Location: France

Re: Replace AU3_Spy.exe with script

Post by Zelio » 10 Feb 2014, 12:19

Good idea ! One year ago I tried but I haven't time or good skill...
Perhaps add "iWB2 Learner" or "ahk web recorder" or other ACC.ahk tools in a second tab (tab1 window spy, tab2 webrowser info, tab3 basic acces control,...) old source and modified working script at http://www.ahkarchive.com/archive/ahktools.zip , good tool don't need to die (idea to drag for get info is really good, intuitive or not)
guest3456
Posts: 2419
Joined: 09 Oct 2013, 10:31

Re: Replace AU3_Spy.exe with script

Post by guest3456 » 18 Feb 2014, 11:58

ahk7 wrote: - More extensive version would be AHK Window Info 1.7 by toralt http://www.autohotkey.com/board/topic/8 ... w-info-17/ but the mouse tab works very slow under win8 (perhaps because of the progress controls it uses?)
^ this is what i tend to use

ahk7
Posts: 110
Joined: 06 Nov 2013, 16:35

Re: Replace AU3_Spy.exe with script

Post by ahk7 » 18 Feb 2014, 13:59

Another one that is very well made is Control Viewer by AutoIt scripter Yashied http://www.autoitscript.com/forum/topic ... info-tool/ the source is available.

One thing that I particularly like is that it has that same red outline of the control that iWB2 has, so you can "see" the control you are hovering over - that would be a useful addition to fincs "spy"
jballi
Posts: 498
Joined: 29 Sep 2013, 17:34

Re: Replace AU3_Spy.exe with script

Post by jballi » 21 Feb 2014, 19:58

I'm liking this idea with one modification... Release it as an executable. OK, two executables -- a 32-bit version and a 64-bit version. The source can still be included if you want but executables allow developers to download and go. Also, the script doesn't need to be recompiled with each new version. The only reason to recompile would be if the source were changed or if the new release included some performance improvements. If it ain't broke, no need to recompile.

Just my 2 cents.
just me
Posts: 5510
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Replace AU3_Spy.exe with script

Post by just me » 22 Feb 2014, 01:57

It's high time for a change. The "AutoIt3 Window Spy" has been replaced even for AutoIt years ago (in case they ever used it).
ahk7
Posts: 110
Joined: 06 Nov 2013, 16:35

Re: Replace AU3_Spy.exe with script

Post by ahk7 » 05 Oct 2014, 07:56

The Au3Info.exe (AutoIt v3 Window Info) that comes with AutoIt v3 does seem to see more information from time to time then the old (current) AU3_Spy.exe that comes with AHK and also this script by fincs and other AHK window tools.

Test case: Total Commander 32 and 64 bit - a file manager where you can have multiple tabs open (like in your browser) - AU3_Spy.exe doesn't report the tab-control, this script doesn't either, but Au3Info.exe and another Window Spy tool like http://alinconstantin.dtdns.net/Download/WinCheat/ does see SysTabControl321 (64bit) or TMyTabControl1 (32bit) when you place your mouse over them.

If I use "Example #3: Extract the individual control names from a ControlList" from http://ahkscript.org/docs/commands/WinGet.htm AutoHotkey does list these controls and you can use SendMessages to count and control the tabs as well.

Is there anyway to improve the class name of the control under the mouse that is currently reported in this Active Window Info script?

For reference:

ControlsAtPos()
http://www.autohotkey.com/board/topic/1 ... -position/

Get control based in hwnd
http://www.autohotkey.com/board/topic/4 ... l-classnn/
guest3456
Posts: 2419
Joined: 09 Oct 2013, 10:31

Re: Replace AU3_Spy.exe with script

Post by guest3456 » 25 Aug 2016, 14:45

https://autohotkey.com/boards/viewtopic ... 625#p75625
Lexikos wrote: v1.1.23.03

Fixed Window Spy to fall back to #vk41 for its hotkey when "A" does not exist on the current keyboard layout.
@Lexikos:

where can I find your source for the AU3_Spy?

User avatar
tank
Posts: 2373
Joined: 28 Sep 2013, 22:15
Facebook: charlie.simmons.7334
Google: ttnnkkrr
GitHub: ttnnkkrr
Location: Louisville KY
Contact:

Re: Replace AU3_Spy.exe with script

Post by tank » 25 Aug 2016, 22:46

we do not nor did we ever have the source for it. Had this conversation with Chris years back
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
https://www.facebook.com/ahkscript.org
If you have forum suggestions please submit a pull request
guest3456
Posts: 2419
Joined: 09 Oct 2013, 10:31

Re: Replace AU3_Spy.exe with script

Post by guest3456 » 25 Aug 2016, 22:56

tank wrote:we do not nor did we ever have the source for it. Had this conversation with Chris years back
uh isn't the Window Spy that is currently provided with the distribution the same AHK-based one that fincs gave in this very thread?

and did you read my post? how do you explain my quote where Lexikos said he 'fixed it' if there is no source'?

Post Reply

Return to “Wish List”