Sign in to follow this  
Followers 0
callagga

how do I discover an applications controls details???

9 posts in this topic

Hi,

How can I discover the controls within a Windows Application? Is there a tool available for this? That is so I can use things like ControlClick in AutoIT which require things like ID, TEXT, CLASS, CLASSNN etc.

Background:

* I have an application I want to use AutoIT for however there are some things I need to do for which there are no ALT key methods.

* I would like to avoid using mouse position as I assume this would then make the application sensitive to it's position/sizing. So my thinking is to try to use functions like ControlClick.

* I have some controls like Buttons, Tabs (i.e. tabs horizontally across the top of an area of the application for which you can click a particular tab and then see details for that tab)

Thanks

Share this post


Link to post
Share on other sites



callagga,

First, welcome to the AutoIt forums.

To discover the details of controls in other apps, use the Au3 Window Info tool. You should find it at "C:\Program Files\AutoIt3\Au3Info.exe" if you made a standard install. Its operation is pretty self-explanatory and allows you to get all the ID, TEXT, CLASS, CLASSNN, etc info for standard windows and controls. >_<

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

To discover the details of controls in other apps, use the Au3 Window Info tool. You should find it at "C:\Program Files\AutoIt3\Au3Info.exe" if you made a standard install. Its operation is pretty self-explanatory and allows you to get all the ID, TEXT, CLASS, CLASSNN, etc info for standard windows and controls. >_<

Thanks - thats excellent.

It seems however in my case as I mouse across the tabs they are all in the same Window/Control. The only thing that seems to change is the mouse position. I guess this implies I'll have to do a click based on mouse position (perhaps relative to the window its in)?

Share this post


Link to post
Share on other sites

callagga,

To the best of my knowledge that is the case. Unfortunately, many apps use custom controls that AutoIt cannot handle via the API and so using mouse coordinates is the only way >_< . Do remember that you can use Opt("MouseCoordMode") to change the way the coords are handles (screen or active window) - and that the current setting is returned when you change it, enabling you to reset the initial value when finished.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Is that what you're trying to do?

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Form1", 320, 52, 192, 124)
$Label1 = GUICtrlCreateLabel("Use MouseMove() based on the window position with WinGetPos().", 0, 0, 322, 17)
$Button1 = GUICtrlCreateButton("Button1", 0, 24, 75, 25, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Button2", 240, 24, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $GetPos = WinGetPos($Form1)
            MouseMove($GetPos[0]+280,$GetPos[1]+63,0)
        Case $Button2
            $GetPos = WinGetPos($Form1)
            MouseMove($GetPos[0]+37,$GetPos[1]+63,0)
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites

Is that what you're trying to do?

I don't think so. I have an existing application that has a number of tabs within a windows/control, and I wanted to click directly on one specific tab...

Share this post


Link to post
Share on other sites

#include <GUIConstantsEx.au3>
#include <TreeViewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiTab.au3>
#include <GuiButton.au3>

$Form1 = GUICreate("Form1", 400, 150, 192, 124)
$tab = GUICtrlCreateTab(8, 8, 300, 97)
$tabbutton = GUICtrlCreateButton('Click tab ... and button',4,120,120)
$b1 = GUICtrlCreateButton('Button1',330,30,50)
$b2 = GUICtrlCreateButton('Button2',330,70,50)
$b3 = GUICtrlCreateButton('Button2',330,110,50)
$tabitem1 = GUICtrlCreateTabItem("0")
$tabitem2 = GUICtrlCreateTabItem("1")
$tabitem3 = GUICtrlCreateTabItem("2")
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $tabbutton
            If GUICtrlRead($tab) = '0' Then
                _GUICtrlTab_ClickTab($tab,'1')
            ElseIf GUICtrlRead($tab) = '1' Then
                _GUICtrlTab_ClickTab($tab,'2')
            ElseIf GUICtrlRead($tab) = '2' Then
                _GUICtrlTab_ClickTab($tab,'0')
            EndIf
        Case $tab
            If GUICtrlRead($tab) = '0' Then
                _GUICtrlButton_Click($b1)
            ElseIf GUICtrlRead($tab) = '1' Then
                _GUICtrlButton_Click($b2)
            ElseIf GUICtrlRead($tab) = '2' Then
                _GUICtrlButton_Click($b3)
            EndIf
    EndSwitch
WEnd

?

Share this post


Link to post
Share on other sites

Actually I'm not sure where to look up doco for your "_GUICtrlTab_ClickTab" function? Still trying to understand your code. It seems to be however polling via the "GUIGetMsg()" function, however what I'm trying to do it not poll for anything but at a particular point in my script I want to "click" on one of the tabs within a window I have...

thanks for persisting - if you can give me some pointers re where doco is regarding AutoIt for these #include's and functions such as "_GUICtrlTab_ClickTab" I'll look them up...

Tks

Share this post


Link to post
Share on other sites

Actually I'm not sure where to look up doco for your "_GUICtrlTab_ClickTab" function? Still trying to understand your code. It seems to be however polling via the "GUIGetMsg()" function, however what I'm trying to do it not poll for anything but at a particular point in my script I want to "click" on one of the tabs within a window I have...

thanks for persisting - if you can give me some pointers re where doco is regarding AutoIt for these #include's and functions such as "_GUICtrlTab_ClickTab" I'll look them up...

Tks

If you are in SciTE then select the function (or have the caret somethere in it) and press F1 to open the helpfile at that function.

Otherwise open "AutoIt Help File" from the start-menu.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0