tolyasher Posted July 24, 2008 Share Posted July 24, 2008 Hi Guys, I have a task to verify correctness tooltips text in application. (testing purpose) But I could not get the text of tooltips. I found function _GUIToolTip_GetText($hWnd, $hTool, $iID), but I can not get $iID. Piece of my code below: Local $hWnd = WinGetHandle($wnd[$IDX_WND_NAME],$wnd[$IDX_WND_TEXT]) ; working properly Local $hToolbar = ControlGetHandle($wnd[$IDX_WND_NAME],$wnd[$IDX_WND_TEXT],"[CLASS:msvb_lib_toolbar;INSTANCE:5]") ; working properly Local $hTooltips = _GUICtrlToolbar_GetToolTips($hToolbar) ; working properly Local $TextToolTip = _GUIToolTip_GetText($toolTips, $hWnd, $iID) ; I do not know how to get 3-d parameter $iID (I tried Index of tooltips element $iID = [0..6] (I have 7 tooltips and 7 toolbars elements) - but it does not work ) in the end of this script TextToolTip="" (empty string) Could anybody help me to get the tooltips text. Thanks in advance. Link to comment Share on other sites More sharing options...
martin Posted July 24, 2008 Share Posted July 24, 2008 Hi Guys, I have a task to verify correctness tooltips text in application. (testing purpose) But I could not get the text of tooltips. I found function _GUIToolTip_GetText($hWnd, $hTool, $iID), but I can not get $iID. Piece of my code below: Local $hWnd = WinGetHandle($wnd[$IDX_WND_NAME],$wnd[$IDX_WND_TEXT]) ; working properly Local $hToolbar = ControlGetHandle($wnd[$IDX_WND_NAME],$wnd[$IDX_WND_TEXT],"[CLASS:msvb_lib_toolbar;INSTANCE:5]") ; working properly Local $hTooltips = _GUICtrlToolbar_GetToolTips($hToolbar) ; working properly Local $TextToolTip = _GUIToolTip_GetText($toolTips, $hWnd, $iID) ; I do not know how to get 3-d parameter $iID (I tried Index of tooltips element $iID = [0..6] (I have 7 tooltips and 7 toolbars elements) - but it does not work ) in the end of this script TextToolTip="" (empty string) Could anybody help me to get the tooltips text. Thanks in advance.I think the $ID is the id you used when you created the toolbar component as in _GUICtrlToolbar_AddButton ($hToolbar, $ID, $STD_FILENEW) So if the first id you used was 1000 then the id's are 1000, 1001,1002,.. 1007 I haven't tried it the way you showed so I could be wrong. You can read the text of a displayed tooltip, so for your testing you could move the mouse over the control and check that the tooltip text is correct. #include <array.au3> #include <windowsconstants.au3> $lastList = '' $gui = GUICreate("test tool tip reading") $but1 = GUICtrlCreateButton("sample button",50,50,120,22) GUICtrlSetTip(-1,"this is the tooltip for $But1") $but2 = GUICtrlCreateButton("Another one",50,150,120,22) GUICtrlSetTip(-1,"Tooltip for $but2, but try controls in any other app too.") GUISetState() While GUIGetMsg() <> -3 $List = '' $wl = WinList("[class:tooltips_class32]");get all th etooltips For $n = 1 To $wl[0][0] If BitAND(WinGetState($wl[$n][1]), 2) Then;if visible $List &= WinGetTitle($wl[$n][1]) & '; '; read the title, which for a tooltip is the text EndIf Next If $List <> $lastList And $List <> '' Then ConsoleWrite($List & "Previous = " & $lastlist & @CRLF) $lastList = $List EndIf WEnd Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
tolyasher Posted July 25, 2008 Author Share Posted July 25, 2008 I think the $ID is the id you used when you created the toolbar component as in _GUICtrlToolbar_AddButton ($hToolbar, $ID, $STD_FILENEW) So if the first id you used was 1000 then the id's are 1000, 1001,1002,.. 1007 I haven't tried it the way you showed so I could be wrong. You can read the text of a displayed tooltip, so for your testing you could move the mouse over the control and check that the tooltip text is correct. #include <array.au3> #include <windowsconstants.au3> $lastList = '' $gui = GUICreate("test tool tip reading") $but1 = GUICtrlCreateButton("sample button",50,50,120,22) GUICtrlSetTip(-1,"this is the tooltip for $But1") $but2 = GUICtrlCreateButton("Another one",50,150,120,22) GUICtrlSetTip(-1,"Tooltip for $but2, but try controls in any other app too.") GUISetState() While GUIGetMsg() <> -3 $List = '' $wl = WinList("[class:tooltips_class32]");get all th etooltips For $n = 1 To $wl[0][0] If BitAND(WinGetState($wl[$n][1]), 2) Then;if visible $List &= WinGetTitle($wl[$n][1]) & '; '; read the title, which for a tooltip is the text EndIf Next If $List <> $lastList And $List <> '' Then ConsoleWrite($List & "Previous = " & $lastlist & @CRLF) $lastList = $List EndIf WEnd - Thank you very much for your answer. Your code is very helpful for growing my experience in AutoIT Your code is working properly in many applications. But in my case it does not work (may be in my application used other class for tooltips) - "I think the $ID is the id you used when you created the toolbar component as in"..... I am not a developer of this application. I just test this application and I know that GUI of this app developed on Visual Basic. - I can not understand why _GUIToolTip_GetTitleText and _GUIToolTip_GetText do not work but _GUIToolTip_GetToolCount and _GUIToolTip_ToolExists work properly Link to comment Share on other sites More sharing options...
martin Posted July 25, 2008 Share Posted July 25, 2008 - Thank you very much for your answer. Your code is very helpful for growing my experience in AutoIT Your code is working properly in many applications. But in my case it does not work (may be in my application used other class for tooltips)- "I think the $ID is the id you used when you created the toolbar component as in"..... I am not a developer of this application. I just test this application and I know that GUI of this app developed on Visual Basic.- I can not understand why _GUIToolTip_GetTitleText and _GUIToolTip_GetText do not work but _GUIToolTip_GetToolCount and _GUIToolTip_ToolExists work properly I would try running the application and use AutoIt Window Info to see if you can get the IDs of the components you want to know about. After that I don't have any more ideas apart from finding the class name of the tooltips. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 25, 2008 Moderators Share Posted July 25, 2008 Chances are these are owner drawn. You're not going to get that data the conventional way if they are. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
tolyasher Posted July 25, 2008 Author Share Posted July 25, 2008 I would try running the application and use AutoIt Window Info to see if you can get the IDs of the components you want to know about. After that I don't have any more ideas apart from finding the class name of the tooltips.Thank you for your participation.I did not find the way how to use AutoIt Window Info for tooltips. Tooltips appear below the mouse Link to comment Share on other sites More sharing options...
martin Posted July 25, 2008 Share Posted July 25, 2008 Thank you for your participation.I did not find the way how to use AutoIt Window Info for tooltips. Tooltips appear below the mouseI didn't mean use AutoIt WIndow info for the tooltips, but for the controls in the tool bar. If you can get the ids that way then your original approach might work.Getting the class name for the tooltips is a bit more difficult. I found the class name for tooltips with a little script I've got somewhere, though searching would probably have been quicker.If as, as SmOke_N warns, they are owner drawn and then it could be very difficult.(Meaning I don't know how.) Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. 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