Iczer Posted May 3, 2013 Share Posted May 3, 2013 How i can get text from this control ?ControlGetText return blank string, but Window Info tool work without fail - how i can repeat this magic in my script?>>>> Control <<<< Class: Static Instance: 5 ClassnameNN: Static5 Name: Advanced (Class): [CLASS:Static; INSTANCE:5] ID: 1002 Text: ftp1-zlb.vips.scl3.mozilla.com, HTTP (TCP:80) <--------------- this string Position: 196, 102 Size: 284, 24 ControlClick Coords: 60, 10 Style: 0x50024000 ExStyle: 0x00000004 Handle: 0x00C805F6 >>>> Visible Text <<<< Static Static Static Static Static Button Button Button Button ComboBox Button Button Static Button Button Static SysLink Link to comment Share on other sites More sharing options...
BinaryBrother Posted May 3, 2013 Share Posted May 3, 2013 Make sure you don't have a hidden window with the same title. ^.^ SIGNATURE_0X800007D NOT FOUND Link to comment Share on other sites More sharing options...
Iczer Posted May 3, 2013 Author Share Posted May 3, 2013 Yes, there is two window with the same title, but this script cannot get text from either, so question about magic.. expandcollapse popup#include #include $a = WinList ( "Outpost Firewall Pro" ) For $i = 1 To $a[0][0] Var_GetAllWindowsControls2($a[$i][1]) Next Func Var_GetAllWindowsControls2($hCallersWindow) ; Get all list of controls $sClassList = WinGetClassList($hCallersWindow) ; Create array $aClassList = StringSplit($sClassList, @CRLF, 2) ; Sort array _ArraySort($aClassList) _ArrayDelete($aClassList, 0) ; Loop $iCurrentClass = "" $iCurrentCount = 1 $iTotalCounter = 1 For $i = 0 To UBound($aClassList) - 1 If $aClassList[$i] = $iCurrentClass Then $iCurrentCount += 1 Else $iCurrentClass = $aClassList[$i] $iCurrentCount = 1 EndIf $hControl = ControlGetHandle($hCallersWindow, "", "[CLASSNN:" & $iCurrentClass & $iCurrentCount & "]") ;$text = StringRegExpReplace(ControlGetText($hCallersWindow, "", $hControl),"[\n\r]","[email="{@CRLF"]{@CRLF[/email]}") $text = ControlGetText($hCallersWindow, "", $hControl) $aPos = ControlGetPos($hCallersWindow, "", $hControl) $sControlID = _WinAPI_GetDlgCtrlID($hControl) If IsArray($aPos) Then ConsoleWrite("ControlCounter=[" & $iTotalCounter & "] ControlID=[" & $sControlID & "] Handle=[" & $hControl & "] ClassNN=[" & $iCurrentClass & $iCurrentCount & "] XPos=[" & $aPos[0] & "] YPos=[" & $aPos[1] & "] Width=[" & $aPos[2] & "] Height=[" & $aPos[3] & "] Text=[" & $text & "]." & @CRLF) Else ConsoleWrite("ControlCounter=[" & $iTotalCounter & "] ControlID=[" & $sControlID & "] Handle=[" & $hControl & "] ClassNN=[" & $iCurrentClass & $iCurrentCount & "] XPos=[winclosed] YPos=[winclosed] Width=[winclosed] Height=[winclosed] Text=[" & $text & "]." & @CRLF) EndIf If Not WinExists($hCallersWindow) Then ExitLoop $iTotalCounter+=1 Next EndFunc Output of script: ControlCounter=[1] ControlID=[4] Handle=[0x000C0660] ClassNN=[button1] XPos=[12] YPos=[146] Width=[468] Height=[70] Text=[]. ControlCounter=[2] ControlID=[1024] Handle=[0x00190686] ClassNN=[button2] XPos=[12] YPos=[216] Width=[468] Height=[70] Text=[]. ControlCounter=[3] ControlID=[1078] Handle=[0x000B0674] ClassNN=[button3] XPos=[12] YPos=[286] Width=[466] Height=[70] Text=[]. ControlCounter=[4] ControlID=[1079] Handle=[0x00140646] ClassNN=[button4] XPos=[12] YPos=[356] Width=[468] Height=[70] Text=[]. ControlCounter=[5] ControlID=[1065] Handle=[0x0023062A] ClassNN=[button5] XPos=[12] YPos=[458] Width=[182] Height=[28] Text=[]. ControlCounter=[6] ControlID=[1031] Handle=[0x000F064C] ClassNN=[button6] XPos=[199] YPos=[458] Width=[141] Height=[28] Text=[]. ControlCounter=[7] ControlID=[1059] Handle=[0x000C066C] ClassNN=[button7] XPos=[12] YPos=[514] Width=[468] Height=[20] Text=[]. ControlCounter=[8] ControlID=[1007] Handle=[0x00110602] ClassNN=[button8] XPos=[12] YPos=[508] Width=[158] Height=[28] Text=[]. ControlCounter=[9] ControlID=[1008] Handle=[0x001F0664] ClassNN=[button9] XPos=[173] YPos=[508] Width=[170] Height=[28] Text=[]. ControlCounter=[10] ControlID=[1000] Handle=[0x000E065E] ClassNN=[ComboBox1] XPos=[335] YPos=[394] Width=[140] Height=[28] Text=[]. ControlCounter=[11] ControlID=[1042] Handle=[0x002E063C] ClassNN=[static1] XPos=[12] YPos=[78] Width=[32] Height=[32] Text=[]. ControlCounter=[12] ControlID=[1009] Handle=[0x000F068E] ClassNN=[static2] XPos=[74] YPos=[74] Width=[100] Height=[24] Text=[]. ControlCounter=[13] ControlID=[1003] Handle=[0x001C0656] ClassNN=[static3] XPos=[196] YPos=[74] Width=[284] Height=[24] Text=[]. ControlCounter=[14] ControlID=[1010] Handle=[0x001606A0] ClassNN=[static4] XPos=[74] YPos=[102] Width=[117] Height=[24] Text=[]. ControlCounter=[15] ControlID=[1002] Handle=[0x0014066E] ClassNN=[static5] XPos=[196] YPos=[102] Width=[284] Height=[24] Text=[]. ControlCounter=[16] ControlID=[1063] Handle=[0x00170662] ClassNN=[static6] XPos=[0] YPos=[142] Width=[490] Height=[2] Text=[]. ControlCounter=[17] ControlID=[1064] Handle=[0x000C0666] ClassNN=[static7] XPos=[0] YPos=[298] Width=[490] Height=[2] Text=[]. ControlCounter=[18] ControlID=[1045] Handle=[0x00170636] ClassNN=[static8] XPos=[0] YPos=[448] Width=[490] Height=[2] Text=[]. ControlCounter=[19] ControlID=[1051] Handle=[0x002C0650] ClassNN=[static9] XPos=[0] YPos=[496] Width=[490] Height=[2] Text=[]. ControlCounter=[20] ControlID=[-1] Handle=[0x000B0618] ClassNN=[static10] XPos=[450] YPos=[466] Width=[30] Height=[16] Text=[]. ControlCounter=[21] ControlID=[0] Handle=[0x0013069E] ClassNN=[sysHeader321] XPos=[14] YPos=[148] Width=[464] Height=[24] Text=[]. ControlCounter=[22] ControlID=[1048] Handle=[0x00190610] ClassNN=[sysLink1] XPos=[12] YPos=[20] Width=[468] Height=[42] Text=[]. ControlCounter=[23] ControlID=[1080] Handle=[0x00110652] ClassNN=[sysListView321] XPos=[12] YPos=[146] Width=[468] Height=[148] Text=[]. ControlCounter=[1] ControlID=[1004] Handle=[0x00010248] ClassNN=[defwindowclass_amd641] XPos=[2] YPos=[0] Width=[1120] Height=[44] Text=[]. ControlCounter=[2] ControlID=[1002] Handle=[0x03FA0096] ClassNN=[defwindowclass_amd642] XPos=[235] YPos=[44] Width=[1307] Height=[638] Text=[]. ControlCounter=[3] ControlID=[1020] Handle=[0x00020224] ClassNN=[msctls_statusbar321] XPos=[0] YPos=[682] Width=[1542] Height=[28] Text=[]. ControlCounter=[4] ControlID=[1001] Handle=[0x00010246] ClassNN=[ReBarWindow321] XPos=[0] YPos=[0] Width=[1542] Height=[44] Text=[]. ControlCounter=[5] ControlID=[1070] Handle=[0x00010226] ClassNN=[static1] XPos=[231] YPos=[44] Width=[4] Height=[638] Text=[]. ControlCounter=[6] ControlID=[1017] Handle=[0x00010228] ClassNN=[static2] XPos=[0] YPos=[631] Width=[231] Height=[51] Text=[]. ControlCounter=[7] ControlID=[0] Handle=[0x035E0122] ClassNN=[sysHeader321] XPos=[237] YPos=[77] Width=[1303] Height=[24] Text=[]. ControlCounter=[8] ControlID=[1024] Handle=[0x07F20128] ClassNN=[sysListView321] XPos=[237] YPos=[77] Width=[1303] Height=[603] Text=[]. ControlCounter=[9] ControlID=[1000] Handle=[0x0001021A] ClassNN=[sysTreeView321] XPos=[0] YPos=[44] Width=[231] Height=[587] Text=[]. ControlCounter=[10] ControlID=[0] Handle=[0x0001024A] ClassNN=[ToolbarWindow321] XPos=[1128] YPos=[11] Width=[414] Height=[22] Text=[]. Link to comment Share on other sites More sharing options...
jdelaney Posted May 3, 2013 Share Posted May 3, 2013 Nice, using my function long shot, but try this at the top of the script: AutoItSetOption("WinDetectHiddenText", 1) 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. Link to comment Share on other sites More sharing options...
Iczer Posted May 3, 2013 Author Share Posted May 3, 2013 10x! for function with AutoItSetOption("WinDetectHiddenText", 1) text is still not detected - Text=[]. Link to comment Share on other sites More sharing options...
BinaryBrother Posted May 3, 2013 Share Posted May 3, 2013 Opt("WinTitleMatchMode", 3) <--- Try taking a look at "WinTitleMatchMode". SIGNATURE_0X800007D NOT FOUND Link to comment Share on other sites More sharing options...
jdelaney Posted May 3, 2013 Share Posted May 3, 2013 (edited) He's able to grab the proper window, and control...just unable to grab the text of the control. You can tell, because the output matches the autoit info tool...there is just a difference in how the autoit info tool grabs the text, and how controlgettext grabs the text:>>>> Control <<<<Class: StaticInstance: 5ClassnameNN: Static5Name:Advanced (Class): [CLASS:Static; INSTANCE:5]ID: 1002Text: ftp1-zlb.vips.scl3.mozilla.com, HTTP (TCP:80) <--------------- this stringControlCounter=[15] ControlID=[1002] Handle=[0x0014066E] ClassNN=[static5] XPos=[196] YPos=[102] Width=[284] Height=[24] Text=[].Then handles are different, but I suspect the autoit info captured the control on a different running instance of the output of Var_GetAllWindowsControls2 Edited May 3, 2013 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. Link to comment Share on other sites More sharing options...
Iczer Posted May 12, 2013 Author Share Posted May 12, 2013 it seems i cant get any progress with ControlGetText returning blank string... maybe someone can get me hint how to get same text as Window Info tool getting from window? on another side - maybe its somewhat of bug? since Window Info tool is as internal for Autoit as ControlGetText... Link to comment Share on other sites More sharing options...
Iczer Posted July 13, 2013 Author Share Posted July 13, 2013 filled the bug ticket #2356 hope it can be fixed in coming betas... Link to comment Share on other sites More sharing options...
junkew Posted July 15, 2013 Share Posted July 15, 2013 Could it be due to 32 bits and 64 bits versions? FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets 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