mf3 Posted June 1, 2017 Share Posted June 1, 2017 Hello. The question is: How to find tab by text and click it? I tried to use this code: $hTab = ControlGetHandle($hWnd, "", "[TEXT:E9077]") ControlClick($hWnd, "", "[TEXT:9077]") and this $hTab = ControlGetHandle($hWnd, "", "[TEXT:E9077]") _GUICtrlTab_SetCurFocus($hTab, 1) But nothing is going on. Help me, please. Link to comment Share on other sites More sharing options...
Danp2 Posted June 1, 2017 Share Posted June 1, 2017 First suggestion would be to do some error handling. Check the @error flag after the call to ControlGetHandle. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
InunoTaishou Posted June 1, 2017 Share Posted June 1, 2017 Try this expandcollapse popup#include <GUIConstantsEx.au3> #include <GuiTab.au3> GUICreate("My GUI Tab") ; will create a dialog box that when displayed is centered GUISetBkColor(0x00E0FFFF) GUISetFont(9, 300) Global $tabMainTab = GUICtrlCreateTab(10, 10, 200, 100) GUICtrlCreateTabItem("tab0") GUICtrlCreateLabel("label0", 30, 80, 50, 20) GUICtrlCreateButton("OK0", 20, 50, 50, 20) GUICtrlCreateInput("default", 80, 50, 70, 20) GUICtrlCreateTabItem("tab----1") GUICtrlCreateLabel("label1", 30, 80, 50, 20) GUICtrlCreateCombo("", 20, 50, 60, 120) GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo|guinness", "Jon") ; default Jon GUICtrlCreateButton("OK1", 80, 50, 50, 20) GUICtrlCreateTabItem("tab2") GUICtrlSetState(-1, $GUI_SHOW) ; will be display first GUICtrlCreateLabel("label2", 30, 80, 50, 20) GUICtrlCreateButton("OK2", 140, 50, 50) GUICtrlCreateTabItem("") ; end tabitem definition Global $btnClick = GUICtrlCreateButton("Select tab 2", 10, 130, 100, 20) GUISetState(@SW_SHOW) Local $idMsg ; Loop until the user exits. While 1 Switch (GUIGetMsg()) Case $GUI_EVENT_CLOSE Exit 0 Case $btnClick _GUICtrlTab_ActivateTabEx($tabMainTab, "tab0") EndSwitch WEnd Func _GUICtrlTab_ActivateTabEx($hWnd, $sText) Local $hTab = IsHWnd($hWnd) ? $hWnd : GUICtrlGetHandle($hWnd) For $i = 0 To _GUICtrlTab_GetItemCount($hTab) If (_GUICtrlTab_GetItemText($hTab, $i) = $sText) Then _GUICtrlTab_ActivateTab($hTab, $i) ExitLoop EndIf Next EndFunc ;==>_GUICtrlTab_ActivateTabEx Link to comment Share on other sites More sharing options...
mf3 Posted June 1, 2017 Author Share Posted June 1, 2017 9 minutes ago, Danp2 said: First suggestion would be to do some error handling. Check the @error flag after the call to ControlGetHandle. I checked. No error occurs after ControlGetHandle. And this ControlCommand ( $hTab, "", "", "TabRight") is working with this handle, but I can't get text of current tab. And ControlClick is still not working... Link to comment Share on other sites More sharing options...
mf3 Posted June 1, 2017 Author Share Posted June 1, 2017 3 minutes ago, InunoTaishou said: Try this expandcollapse popup#include <GUIConstantsEx.au3> #include <GuiTab.au3> GUICreate("My GUI Tab") ; will create a dialog box that when displayed is centered GUISetBkColor(0x00E0FFFF) GUISetFont(9, 300) Global $tabMainTab = GUICtrlCreateTab(10, 10, 200, 100) GUICtrlCreateTabItem("tab0") GUICtrlCreateLabel("label0", 30, 80, 50, 20) GUICtrlCreateButton("OK0", 20, 50, 50, 20) GUICtrlCreateInput("default", 80, 50, 70, 20) GUICtrlCreateTabItem("tab----1") GUICtrlCreateLabel("label1", 30, 80, 50, 20) GUICtrlCreateCombo("", 20, 50, 60, 120) GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo|guinness", "Jon") ; default Jon GUICtrlCreateButton("OK1", 80, 50, 50, 20) GUICtrlCreateTabItem("tab2") GUICtrlSetState(-1, $GUI_SHOW) ; will be display first GUICtrlCreateLabel("label2", 30, 80, 50, 20) GUICtrlCreateButton("OK2", 140, 50, 50) GUICtrlCreateTabItem("") ; end tabitem definition Global $btnClick = GUICtrlCreateButton("Select tab 2", 10, 130, 100, 20) GUISetState(@SW_SHOW) Local $idMsg ; Loop until the user exits. While 1 Switch (GUIGetMsg()) Case $GUI_EVENT_CLOSE Exit 0 Case $btnClick _GUICtrlTab_ActivateTabEx($tabMainTab, "tab0") EndSwitch WEnd Func _GUICtrlTab_ActivateTabEx($hWnd, $sText) Local $hTab = IsHWnd($hWnd) ? $hWnd : GUICtrlGetHandle($hWnd) For $i = 0 To _GUICtrlTab_GetItemCount($hTab) If (_GUICtrlTab_GetItemText($hTab, $i) = $sText) Then _GUICtrlTab_ActivateTab($hTab, $i) ExitLoop EndIf Next EndFunc ;==>_GUICtrlTab_ActivateTabEx Thank You for reply. But window and controls are not created with AutoIt. GUI created by unknown developer with Delphi and .NET as I see Link to comment Share on other sites More sharing options...
InunoTaishou Posted June 1, 2017 Share Posted June 1, 2017 Does the Autoit info tool show SysTabControl32 as the Class of the tab control? If not you could try using this I've never used it so you're on your on to try and see if it'll work with your program you're trying to automate. 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