j8kin Posted May 30, 2008 Share Posted May 30, 2008 I have a problem with identification of control in my Auto-It scrip. I have some dialog and have a lot of controls in it. Also I have ID (it means that I have a handler) of Control which i need to access. But I don't understand how to get information about control such as Class/Type. I search thought WinAPI functions and Auto-It help but failed. Could anybody tell me is it possible to get Class/Type information of control. Thanks Eugene... Link to comment Share on other sites More sharing options...
newbiescripter Posted May 30, 2008 Share Posted May 30, 2008 Use the AutoIt Window Info to see the class of a control Link to comment Share on other sites More sharing options...
j8kin Posted May 30, 2008 Author Share Posted May 30, 2008 Actually I want to get this information in script automatically. I want to do something like: Select Case GetControlInfo($hControl) = "Radio" .... Case GetControlInfo($hControl) = "ListBox" etc Link to comment Share on other sites More sharing options...
litlmike Posted May 30, 2008 Share Posted May 30, 2008 Actually I want to get this information in script automatically.I want to do something like:Select Case GetControlInfo($hControl) = "Radio" .... Case GetControlInfo($hControl) = "ListBox" etcMaybe giving us more info of what you are trying to do would help us out. Though I am not very smart, I cannot think of a situation where this would be helpful for you. The only way I could even dream of doing this currently would be to use through ControlCommand() option until you do not receive an @error of 1. Otherwise, my guess is we need more info of what you are doing to help out. Good Luck. _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
ProgAndy Posted May 30, 2008 Share Posted May 30, 2008 The Class is Detectable with _WinAPI_GetClassName *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
j8kin Posted May 30, 2008 Author Share Posted May 30, 2008 The Class is Detectable with _WinAPI_GetClassNameMSDN: The GetClassName function retrieves the name of the class to which the specified window belongs.I try use it and this function (GetClassName) return Class name of the window not control.Maybe giving us more info of what you are trying to do would help us out.Previously i have a lot of scripts created on Rational Visual Test and I want to convert them into Auto-It scripts.I have some include file with more then 200 Control ID and I want to use this information.Also I have a function such as SetProperty($ID, $Value) which get information about Type/Class of control and put appropriated information in Control.I use RadioButtons/Buttons/EditText/ListBox etc.Of course I could change definition of these existing ID and add this information into it but it's not perfect decision I suppose that it should be possible to get the information about any control automatically if we could do this manually via AutoIt Window Info. Link to comment Share on other sites More sharing options...
ProgAndy Posted May 30, 2008 Share Posted May 30, 2008 (edited) All Controls are Windows Use this: $hwnd = ControlGetHandle("Wahtever","",1234) $Class = _WInAPI_GetClassName($hwnd) #include <GUIConstants.au3> #include <WinAPI.au3> #region - GUI Create $GUI = GUICreate('GUI') GUICtrlCreateLabel("Click Button, Label or Press {F10} to fetch Control/Window ClassInfo",50,10,300,30) $x = GUICtrlCreateButton("hello",10,10) $a = GUICtrlCreateLabel("",10,50,300,50) GUICtrlSetBkColor(-1,0xFF0000) GUICtrlSetFont(-1,12,800) GUISetState() #endregion HotKeySet("{F10}","GetCntrlClass") #region - GUI SelectLoop While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $x $hwnd = GUICtrlGetHandle($x) GUICtrlSetData($a,"Class of Button: " & _WinAPI_GetClassName($hwnd)) Case $msg = $a $hwnd = ControlGetHandle($GUI,"",$a) GUICtrlSetData($a,"Class of Label: " & _WinAPI_GetClassName($hwnd)) EndSelect WEnd #endregion Func GetCntrlClass() $pos = _WinAPI_GetMousePos() $hwnd = _WinAPI_WindowFromPoint($pos) GUICtrlSetData($a,"Class of Control/Win under Mouse: " & @CRLF & _WinAPI_GetClassName($hwnd)) EndFunc Edited May 30, 2008 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
j8kin Posted June 2, 2008 Author Share Posted June 2, 2008 To ProgAndy: The problem is that Class name for Radio buttons, Check box and buttons are "Button" I still do not understand how to separate them if I have a handler and ID of Control. 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