AutoHotkey Community

It is currently May 26th, 2012, 8:22 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: August 14th, 2009, 5:42 am 
Offline

Joined: March 3rd, 2005, 5:43 am
Posts: 62
All the instructions for using the Window Spy Script are included
as remarks in the top of the Script, so I won't repeat them here.

I'm far from an expert at writing AutoHotKey scripts, but I'm
learning a little more each day. There is one issue that I had
difficulty resolving though. I made a feeble effort to have the
width of the DropDownList adjusted according to the length
of the longest parameter in the list. Although my method
offered some control for that, it was far from perfect and
could use improvement. If anyone has any ideas on how to
improve that feature, please share.....

Code:
; Ahk Window Spy, Uses RCtrl - F11 and  RCtrl - F12

/*
RCtrl - F11  Enables Window Spy which displays
a Tooltip showing the Window Parameters beneath
the mouse pointer.

RCtrl - F12  Disables Window Spy, Removes the Tooltip
and Displays a DropDownList of the parameters returned.
You can then select the parameter you need from the
List and it will be returned to you on the Windows Clipboard.

If you need more than one item from the DropDownList,
Pressing RCtrl - F12  again allows you to grab another
parameter from the list.

The Basic Routine which grabs the Windows Information
and displays the Tooltip came from the AutoHotKey Help File.
This script just gives you a more user-friendly way of exctracting
the information you need for later use.
*/

#singleinstance force
RCtrl & F11::
SetTimer, WatchCursor, 100
return

WatchCursor:
MouseGetPos, , , id, control
WinGetTitle, title, ahk_id %id%
WinGetClass, class, ahk_id %id%
ToolTip, ahk_id %id%`nahk_class %class%`n%title%`nControl: %control%
data1 = ahk_class %class%|ahk_id %id%|%title%|Control: %control%
return

RCtrl & F12::
SetTimer, WatchCursor, Off
ToolTip
gosub, DDL
return

DDL:
width = 0
Loop, 4
{
if (strlen(data1) > width)
   width := strlen(data1)
}
width := Round(strlen(data1) * 4.4) ; Attempt to Determine width needed by DropDownList
StringReplace, data, data1, |, ||  ; Make 1st item in List Default Selection
Gui, +AlwaysOnTop +ToolWindow
Gui, font, s11, Arial
Gui, Add, DropDownList, % "x20 y15 R4 w" . width . " gGrabit vWindata", %data%
Gui, Show, % "h50 w" . width + 40
Return

Grabit:
Gui, Submit
sleep, 100
clipboard = %Windata%
GuiClose:
GuiEscape:
Gui, Destroy
return


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google [Bot], Google Feedfetcher, notsoobvious and 20 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