AutoHotkey Community

It is currently May 26th, 2012, 12:54 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Winformer By Precise
PostPosted: November 6th, 2008, 1:15 pm 
Offline

Joined: December 30th, 2007, 5:42 pm
Posts: 31
Location: East Coast
Winformer v1.01
v1.00 - 11/6/08 (Initial release date)
v1.01 - 12/28/08
v1.02 - 3/6/09

Change Log:
- Added Coordmode, thanks tonne
- Removed physical window activation
- Changed coordmode to mouse/relative

Basic Information:
Winformer displays information on the window and control that's currently under your mouse. It shows the title/type, size, location, and handle for the window and control. It also shows the mouse position relative to the screen and the active window. This tool is similar to the Window Spy utility that's bundled with AutoHotKey, it's just condensed and focused a little differently. The objective is to indirectly help some of the beginners figure out some simple concepts about windows and controls and make it easier for developers to find the relative locations to use with the control functions. It helps you target the specific control you want (which can be confusing) and it shows you the different relative locations within that control.

Main Features:
  • Window title and control type
  • Window and control handle
  • Window and control location
  • Window and control size
  • Mouse position relative to the screen
  • Mouse position relative to the window under the mouse
  • Screen resolution

Gui Screen:
Image

Source Code:
Code:
Menu, Tray, Tip, Winformer By Precise
SetWorkingDir %A_ScriptDir%
SendMode Input
#NoEnv
Gui +Owner +OwnDialogs +AlwaysOnTop
Gui, Font, cBlack s7, Verdana
Gui, Add, GroupBox, x8 y3 w256 h115, Window
Gui, Add, Listbox, w240 r1 x15 y18 vScreenSize, Screen:%A_Tab%%A_ScreenWidth%x%A_ScreenHeight%
Gui, Add, Listbox, w240 r1 x15 y+3 vWinName, Name:
Gui, Add, Listbox, w240 r1 x15 y+3 vWinHandle, Id:
Gui, Add, Listbox, w240 r1 x15 y+3 vWinDim, Dim:
Gui, Add, Listbox, w240 r1 x15 y+3 vWinLoc, Loc:
Gui, Add, GroupBox, x8 y123 w256 h60, Mouse
Gui, Add, Listbox, w240 r1 x15 y139 vMouseLoc, Loc:
Gui, Add, Listbox, w240 r1 x15 y+3 vMScreenLoc, SLoc:
Gui, Add, GroupBox, x8 y187 w256 h100, Control
Gui, Add, Listbox, w240 r1 x15 y204 vCtrlType, Type:
Gui, Add, Listbox, w240 r1 x15 y+3 vCtrlHandle, Id:
Gui, Add, Listbox, w240 r1 x15 y+3 vCtrlDim, Dim:
Gui, Add, Listbox, w240 r1 x15 y+3 vCtrlLoc, Loc:
Gui, Show,, Winformer

Updater:
;===============
CoordMode,Mouse,Relative
MouseGetPos, MouseX, MouseY, WinHandle, CtrlHandle, 2       
WinGetTitle, WinName, ahk_id %WinHandle%
WinGetPos, WinX, WinY, WinWidth, WinHeight, %WinName%
StringReplace, WinName, WinName, |, l, All
If WinName =
   GuiControl,, WinName, |Name:
Else
   GuiControl,, WinName, |Name:%A_Tab%%WinName%
If WinHandle =
   GuiControl,, WinHandle, |Id:
Else
   GuiControl,, WinHandle, |Id:%A_Tab%%WinHandle%
If WinX =
   dimb = yes
If WinY =   
   dimb = yes
if dimb = yes
   {
   GuiControl,, WinLoc, |Loc:
   dimb = no
   }
Else
   GuiControl,, WinLoc, |Loc:%A_Tab%(%WinX%`, %WinY%)
If WinWidth =
   dimb = yes
If WinHeight =
   dimb = yes
if dimb = yes
   {
   GuiControl,, WinDim, |Dim:
   dimb = no
   }
Else
   GuiControl,, WinDim, |Dim:%A_Tab%%WinWidth%x%WinHeight%
If MouseX =
   dimb = yes
If MouseY =
   dimb = yes
if dimb = yes
   {
   dimb = no
   GuiControl,, MouseLoc, |Loc:
   GuiControl,, MScreenLoc, |SLoc:
   }
Else
   {
   MScreenX := (MouseX + WinX)
   MScreenY := (MouseY + WinY)
   GuiControl,, MouseLoc, |Loc:%A_Tab%(%MouseX%`, %MouseY%)
   If MScreenX =
      dimb = yes
   If MScreenY =
      dimb = yes
   if dimb = yes
      GuiControl,, MScreenLoc, |SLoc:
   Else
      GuiControl,, MScreenLoc, |SLoc:%A_Tab%(%MScreenX%`, %MScreenY%)
   }
If CtrlHandle =                     
   {
   GuiControl,, CtrlHandle, |Id:
   GuiControl,, CtrlDim, |Dim:
   GuiControl,, CtrlLoc, |Loc:
   GuiControl,, CtrlType, |Type:
   }
Else
   {
   ControlGetPos, CtrlX, CtrlY, CtrlWidth, CtrlHeight,, ahk_id %CtrlHandle%
   WinGetClass, CtrlType, ahk_id %CtrlHandle%
   CtrlLoc = (%CtrlX%`, %CtrlY%)
   CtrlDim = %CtrlWidth%x%CtrlHeight%
   GuiControl,, CtrlDim, |Dim:%A_Tab%%CtrlDim%
   GuiControl,, CtrlLoc, |Loc:%A_Tab%%CtrlLoc%
   GuiControl,, CtrlHandle, |Id:%A_Tab%%CtrlHandle%
   GuiControl,, CtrlType, |Type:%A_Tab%%CtrlType%
   }
Goto, Updater
GuiClose:
ExitApp


Download Links:
Mediafire - Winformer v1.02
MegaUpload - Winformer v1.02


Last edited by Precise on March 6th, 2009, 11:32 pm, edited 7 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 6th, 2008, 3:49 pm 
Offline

Joined: May 2nd, 2006, 11:16 pm
Posts: 800
Location: Greeley, CO
No Source Code?

_________________
Image
SoggyDog
Dwarf Fortress:
"The most intriguing game I've ever played."


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 6th, 2008, 11:19 pm 
Offline

Joined: December 30th, 2007, 5:42 pm
Posts: 31
Location: East Coast
SoggyDog wrote:
No Source Code?


Source added.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 6th, 2008, 11:44 pm 
Offline

Joined: May 2nd, 2006, 11:16 pm
Posts: 800
Location: Greeley, CO
Thank you.
Well, done.

_________________
Image
SoggyDog
Dwarf Fortress:
"The most intriguing game I've ever played."


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 7th, 2008, 11:24 pm 
Offline

Joined: December 30th, 2007, 5:42 pm
Posts: 31
Location: East Coast
SoggyDog wrote:
Thank you.
Well, done.


Your welcome and thanks. AHK is an awesome language. I find many people feel that it lacks in capability due to their lack of usage and knowledge of it. I want to give back as much as I can, AHK has helped ease the transition for me from mainframe to application programming. I spend a lot of time writing scripts for various things. I've probably written around 1000 tiny scripts at this point. Winformer is a fairly straight forward and simple script. I may or may not update/upgrade it if there's a desire for more features or information. Much more to come.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 8th, 2008, 12:31 am 
Offline

Joined: June 6th, 2006, 3:19 pm
Posts: 1654
Location: Denmark
I liked it too!
But I needed the class name and didn't like the activation of the window so I changed a little:
Code:
Menu, Tray, Tip, Winformer By Precise
; any working part: Precice
; any broken part: tonne
SetWorkingDir %A_ScriptDir%
SendMode Input
#NoEnv
Gui +Owner +OwnDialogs +AlwaysOnTop
Gui, Font, cBlack s7, Verdana
Gui, Add, GroupBox, x8 y3 w256 h135, Window
Gui, Add, Listbox, w240 r1 x15 yp+15 vScreenSize, Screen:%A_Tab%%A_ScreenWidth%x%A_ScreenHeight%
Gui, Add, Listbox, w240 r1 x15 y+3 vWinTitle, Title:
Gui, Add, Listbox, w240 r1 x15 y+3 vWinClass, Class:
Gui, Add, Listbox, w240 r1 x15 y+3 vWinHandle, Id:
Gui, Add, Listbox, w240 r1 x15 y+3 vWinDim, Dim:
Gui, Add, Listbox, w240 r1 x15 y+3 vWinLoc, Loc:
Gui, Add, GroupBox, x8 y+12 w256 h59, Mouse                 
Gui, Add, Listbox, w240 r1 x15 yp+15 vMouseLoc, Loc:         
Gui, Add, Listbox, w240 r1 x15 y+3 vMScreenLoc, SLoc:
Gui, Add, GroupBox, x8 y+12 w256 h97, Control
Gui, Add, Listbox, w240 r1 x15 yp+15 vCtrlType, Type:
Gui, Add, Listbox, w240 r1 x15 y+3 vCtrlHandle, Id:
Gui, Add, Listbox, w240 r1 x15 y+3 vCtrlDim, Dim:
Gui, Add, Listbox, w240 r1 x15 y+3 vCtrlLoc, Loc:
Gui, Show,, Winformer

SetTimer, Update, 500
Return

Update:
;===============
CoordMode,Mouse,Screen
MouseGetPos, MScreenX, MScreenY, WinHandle, CtrlHandle, 2

WinGetTitle, WinTitle, ahk_id %WinHandle%
WinGetClass, WinClass, ahk_id %WinHandle%
WinGetPos, WinX, WinY, WinWidth, WinHeight, ahk_id %WinHandle%
StringReplace, WinTitle, WinTitle, |, l, All
If WinTitle =
   GuiControl,, WinTitle, |Title:
Else
   GuiControl,, WinTitle, |Title:%A_Tab%%WinTitle%
If WinClass =   
   GuiControl,, WinClass, |Class:
Else
   GuiControl,, WinClass, |Class:%A_Tab%%WinClass%
If WinHandle =
   GuiControl,, WinHandle, |Id:
Else
   GuiControl,, WinHandle, |Id:%A_Tab%%WinHandle%

GuiControl,, WinLoc, |Loc:%A_Tab%(%WinX%`, %WinY%)
GuiControl,, WinDim, |Dim:%A_Tab%%WinWidth%x%WinHeight%

MouseX := MScreenX - WinX
MouseY := MScreenY - WinY
GuiControl,, MouseLoc, |Loc:%A_Tab%(%MouseX%`, %MouseY%)
GuiControl,, MScreenLoc, |SLoc:%A_Tab%(%MScreenX%`, %MScreenY%)

If CtrlHandle =                     
{
   GuiControl,, CtrlHandle, |Id:
   GuiControl,, CtrlDim, |Dim:
   GuiControl,, CtrlLoc, |Loc:
   GuiControl,, CtrlType, |Type:
}
Else
{
   ControlGetPos, CtrlX, CtrlY, CtrlWidth, CtrlHeight,, ahk_id %CtrlHandle%
   WinGetClass, CtrlType, ahk_id %CtrlHandle%
   CtrlLoc = (%CtrlX%`, %CtrlY%)
   CtrlDim = %CtrlWidth%x%CtrlHeight%
   GuiControl,, CtrlDim, |Dim:%A_Tab%%CtrlDim%
   GuiControl,, CtrlLoc, |Loc:%A_Tab%%CtrlLoc%
   GuiControl,, CtrlHandle, |Id:%A_Tab%%CtrlHandle%
   GuiControl,, CtrlType, |Type:%A_Tab%%CtrlType%
}
Return
   
GuiClose:
ExitApp

Sadly I didnt comment my changes, but as I remember a little change to the GUI (obviously), a little change to the mouse calculation and lesser control for empty values...

_________________
RegEx Powered Dynamic Hotstrings
COM
AutoHotkey 2


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 8th, 2008, 12:45 am 
Offline

Joined: December 30th, 2007, 5:42 pm
Posts: 31
Location: East Coast
Very nice, I think this command: "CoordMode, Mouse, Screen" takes the place of the activation right? What was happening, was that the coordinates were not updating properly without activation. When controls changed, the active window was not changing. This seems to work well, thanks for the update. I will add some of this to the main script and repost it as a new version when I have had a chance to mess with the CoordMode command.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject: 12/28/08 Updates
PostPosted: December 28th, 2008, 7:10 am 
Offline

Joined: December 30th, 2007, 5:42 pm
Posts: 31
Location: East Coast
Updated to version 1.01. Changes will be noted in the change log in the main post. I would like to get more details on windows, possibly even attempt to hook the window messages so i could display those as well. If anyone has any suggestions for future updates, just let me know. Thanks for the coordmode command updates tonne.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], DataLife and 12 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group