 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Jon
Joined: 28 Apr 2004 Posts: 373
|
Posted: Sun Sep 12, 2004 12:53 am Post subject: Window Info |
|
|
This is a relatively simple script. It's function is similar to Autoit 3 Window spy but it show just the most regulary used information about a window in the top left corner of the screen.
Press Ctrl and Left Click to display the results in a form where the information can be copied from. The latest version of AHK (with GUI support) needs to be installed.
Click on the tooltip (top left) and drag to move it.
| Code: |
CoordMode, ToolTip, Screen
CoordMode, Mouse, Screen
CoordMode, Pixel, Screen
newx=0
newy=0
top:
loop
{
MouseGetPos, X, Y, Win, Control
CoordMode, Mouse, Relative
MouseGetPos, Xrel, Yrel
CoordMode, Mouse, Screen
WinGetClass, WinClass, ahk_id %Win%
if WinClass=tooltips_class32
{
tooltip,Click and drag to move`n,%newx%,%newy%
GetKeyState, State, LButton, P
if state=d
{
loop
{
MouseGetPos, X, Y
WinMove, ahk_class tooltips_class32,, %X%, %Y%
newx=%x%
newy=%y%
GetKeyState, State, LButton, P
if state=u
goto, top
}
}
}
continue:
PixelGetColor, Pixel, %X%, %Y%
WinGetTitle, Title, ahk_id %Win%
tooltip,%Title%`nahk_class %WinClass%`nahk_id %Win%`nControl:%a_tab%%a_tab% %control%`nPixel: %a_tab%%a_tab% %Pixel%`nScreen: %a_tab% X %x% Y %y%`nWindow: %a_tab% X %Xrel% Y %Yrel%,%newx%,%newy%
sleep, 100
}
return
^LButton::
gui destroy
; Generated by SmartGUI Creater
Gui, Add, Text, x17 y11 w90 h20, Window Title
Gui, Add, Text, x17 y41 w90 h20, Window Class
Gui, Add, Text, x17 y71 w90 h20, Window ID
Gui, Add, Text, x17 y101 w90 h20, Control
Gui, Add, Text, x17 y131 w90 h20, Pixel
Gui, Add, Edit, x117 y11 w220 h20, %Title%
Gui, Add, Edit, x117 y41 w220 h20, ahk_class %WinClass%
Gui, Add, Edit, x117 y71 w220 h20, ahk_id %Win%
Gui, Add, Edit, x117 y101 w220 h20, %control%
Gui, Add, Edit, x117 y131 w220 h20, %Pixel%
Gui, Add, GroupBox, x7 y161 w340 h100, Mouse coordinates
Gui, Add, Text, x17 y191 w90 h20, Screen
Gui, Add, Text, x17 y221 w90 h20, Window
Gui, Add, Text, x97 y191 w10 h20, X
Gui, Add, Text, x97 y221 w10 h20, X
Gui, Add, Text, x197 y191 w10 h20, Y
Gui, Add, Text, x197 y221 w10 h20, Y
Gui, Add, Edit, x117 y191 w70 h20, %x%
Gui, Add, Edit, x217 y191 w70 h20, %y%
Gui, Add, Edit, x117 y221 w70 h20, %Xrel%
Gui, Add, Edit, x217 y221 w70 h20, %Yrel%
Gui, Show, x400 y300 h265 w354, Window Info
Return
GuiClose:
gui, cancel
Return
|
edit:
Just realised that there is no reason for it to display the ahk_id. I'll remove that tommorrow.
Last edited by Jon on Sun Sep 12, 2004 1:06 pm; edited 2 times in total |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10471
|
Posted: Sun Sep 12, 2004 1:31 am Post subject: |
|
|
That's very good. I love the way you can drag the tooltip window around.
One thing that's not quite right: You should not add the controls each time the user presses the hotkey. That causes them to get duplicated every time, so you wind up with stacks of identical controls all on top of one another. Eventually, you will hit the limit, which is currently 500 controls.
Normally, the program will warn you when you try to do something like this. But because all your controls lack associated variables, it can't detect the duplicates.
To resolve this, add the controls only once (usually in the auto-execute section at the top of the script). When the hotkey is pressed, do some ControlSetText's to fill in the fields followed by a plain "gui show". As a more simple alternative, you could insert a "gui destroy" before all the current "gui add" statements. That way, the window will start off fresh with zero controls each time the hotkey is pressed. |
|
| Back to top |
|
 |
Jon
Joined: 28 Apr 2004 Posts: 373
|
Posted: Sun Sep 12, 2004 1:12 pm Post subject: |
|
|
Thanks for the feedback. I did notice some strange behavior at first which is why I made it reload when the GUI was closed but that wasn't a perfect solution. I can see from your explanation why that behaviour would have occured.
I've just added the gui, destroy and replaced the reload with gui, cancel. It's working much better now.
Thanks, Jon |
|
| Back to top |
|
 |
YOMADDOG
Joined: 11 Dec 2004 Posts: 4
|
Posted: Thu Dec 30, 2004 2:47 pm Post subject: |
|
|
Ya know what would be a great addition?
A "WM_COMMAND" ID line for getting toolbar info!!! _________________ -buttons, buttons,...
-I like to push all the buttons... |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5376 Location: /b/
|
Posted: Thu Dec 30, 2004 4:45 pm Post subject: |
|
|
Nice script  |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|