callagga Posted August 24, 2009 Share Posted August 24, 2009 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 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 24, 2009 Moderators Share Posted August 24, 2009 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
callagga Posted August 24, 2009 Author Share Posted August 24, 2009 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)? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 25, 2009 Moderators Share Posted August 25, 2009 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Info Posted August 25, 2009 Share Posted August 25, 2009 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 Link to comment Share on other sites More sharing options...
callagga Posted August 26, 2009 Author Share Posted August 26, 2009 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... Link to comment Share on other sites More sharing options...
Info Posted August 26, 2009 Share Posted August 26, 2009 expandcollapse popup#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 ? Link to comment Share on other sites More sharing options...
callagga Posted August 26, 2009 Author Share Posted August 26, 2009 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 Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted August 26, 2009 Share Posted August 26, 2009 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...TksIf 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. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now