jdelaney Posted February 28, 2012 Posted February 28, 2012 (edited) I have an array of button handles for a windows based app, and I'm trying to get the ToolTip information so I may identify them (I'd rather not use hard coded references, we have lots of user rights and configurations). I thought the ToolTip info text would be best to do this, but can't get the _GUIToolTip* functions to work. #include <GuiToolbar.au3> #include <GuiButton.au3> #include <Array.au3> opt ( "MouseCoordMode", 2 ) For $i = 0 to UBound ( $asControlCollection ) - 1 $GetText = _GUICtrlButton_GetText ( $asControlCollection[$i][0] ) $GetTMar = _GUICtrlButton_GetTextMargin ( $asControlCollection[$i][0] ) $GetNote = _GUICtrlButton_GetNote ( $asControlCollection[$i][0] ) MouseMove ( $asControlCollection[$i][1] + 5, $asControlCollection[$i][2] + 5) sleep ( 3000 )_ GUIToolTip_Activate ( $asControlCollection[$i][0], True ) $asTest2 = _GUIToolTip_GetCurrentTool ( $asControlCollection[$i][0] ) _ArrayDisplay ( $asTest2 ) msgbox ( 4096, "test", "GetText=[" & $GetText & "]; GetTextMargin=[" & $GetTMar & "]; GetNote=[" & $GetNote & "]." ) Next The array that is returned is always filled out with "0" for each of the levels. I added a mouse over, and I'm able to view to tooltip, but still not able to record it. Edited February 28, 2012 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
jdelaney Posted February 28, 2012 Author Posted February 28, 2012 and, solved: lainline, It becomes a bit more complicated if you want to read the tips of another application. Take a look at this: expandcollapse popup#include <WindowsConstants.au3> #include <GuiToolTip.au3> HotKeySet("{F1}", "_Read_Tip") HotKeySet("{ESC}", "On_Exit") ; Choose your app Global $sTitle = "[CLASS:WordPadClass]" WinWaitActive($sTitle, "", 10) ; Get PID of your app Global $iPID = WinGetProcess($sTitle) ; Keep the script running While 1 Sleep(10) WEnd Func _Read_Tip() ; Get list of tooltips Local $aTipList = WinList("[CLASS:tooltips_class32]") ; See which belong to your app For $i = 1 To $aTipList[0][0] If WinGetProcess($aTipList[$i][1]) = $iPID Then ; See which one is active Local $aRet = _GUIToolTip_GetCurrentTool($aTipList[$i][1]) ; If one is active then display it If $aRet[8] <> "" Then MsgBox(0, "Visible Tip", $aRet[8]) EndIf Next EndFunc Func On_Exit() Exit EndFunc You have 10 seconds to get WordPad active after starting the script. Then every time you press F1 and there is an active Tooltip you will get a MsgBox with the text. Press ESC to exit the script. I hope that is what you want. M23 I modified it a bit, to work with my loop. IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Moderators Melba23 Posted February 28, 2012 Moderators Posted February 28, 2012 jdelaney, I had forgotten all about that! Glad I could help - even though I did not. M23 jdelaney 1 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
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