jdelaney Posted May 23, 2013 Share Posted May 23, 2013 (edited) yeap, that's another one you need go download the winapi UDF from example forum. #include <WinAPI.au3> OR, just comment out that line, and replace with $sControlID = ""...if you go this route, you will have to use the CLASSNN to interact with the control...you will see that on the console output Edited May 23, 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...
Developers Jos Posted May 23, 2013 Developers Share Posted May 23, 2013 How about you open the helpfile and look for the required include files for the UDF's you use in the script? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
klerindias Posted May 23, 2013 Author Share Posted May 23, 2013 Ok got no error: got this: and what it means, i just wanted to have result from the calculator and from something seems easy going to something i dont understand. Func=[Var_GetAllWindowsControls]: ControlCounter=[1] ControlID=[1052] Handle=[0x000D04D2] ClassNN=[button1] XPos=[179] YPos=[16] Width=[17] Height=[16] Text=[ˇ]. Func=[Var_GetAllWindowsControls]: ControlCounter=[2] ControlID=[1051] Handle=[0x000D0516] ClassNN=[button2] XPos=[157] YPos=[16] Width=[17] Height=[16] Text=[^]. Func=[Var_GetAllWindowsControls]: ControlCounter=[3] ControlID=[153] Handle=[0x000D04C8] ClassNN=[ListBox1] XPos=[17] YPos=[36] Width=[178] Height=[73] Text=[]. Link to comment Share on other sites More sharing options...
jdelaney Posted May 23, 2013 Share Posted May 23, 2013 (edited) what was the actual text you were attempting to grab at run time? Sometimes things aren't as 'simple' as they would seem. Once you script it once, it's easy in the future. You need to provid your code...maybe you are passing in the wrong "control" to my function...run again when there are actual numbers in the fields, so you can pull data, and find your control send back the auto it window info 'control' data for YOUR specific control again...don't just blindly use the one i provided in my example script. Edited May 23, 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...
klerindias Posted May 23, 2013 Author Share Posted May 23, 2013 Yea. I just want to get result from calc and put to the file. I used controlgetext function but it seems now working, thats all Link to comment Share on other sites More sharing options...
klerindias Posted May 23, 2013 Author Share Posted May 23, 2013 This works found on: http://www.linkedin.com/groups/Is-controlgettext-function-not-working-1125217.S.98763525 Run('calc.exe') $handle = WinWait('Calculator') ControlSend($handle,'','[CLASS:#32770; INSTANCE:1]','50') ControlSend($handle,'','[CLASS:#32770; INSTANCE:1]','{NUMPADADD}') ControlSend($handle,'','[CLASS:#32770; INSTANCE:1]','25') ControlSend($handle,'','[CLASS:#32770; INSTANCE:1]','{NUMPADENTER}') ControlSend($handle,'','[CLASS:#32770; INSTANCE:1]','^c') $result = ClipGet() MsgBox(0,'RESULT',$result) Link to comment Share on other sites More sharing options...
jdelaney Posted May 23, 2013 Share Posted May 23, 2013 (edited) this would work too controlsend's are sketchy, btw...sometimes they won't be picked up by the window expandcollapse popup$hControl = controlgethandle("Calculator", "", "[CLASS:#32770; INSTANCE:2]") $test = WinGetText($hControl) Var_GetAllWindowsControls2($hControl) Func Var_GetAllWindowsControls2($hCallersWindow) ;~ $giSubFunctionCounter += 1 ; 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]","{@CRLF}") $aPos = ControlGetPos($hCallersWindow, "", $hControl) $sControlID = _WinAPI_GetDlgCtrlID($hControl) If IsArray($aPos) Then ;~ If $gbPerformLog Then Var_SetLogAndActOnState ( 1, $gbLogLevel_Rtrn, "Var_GetAllWindowsControls()", "Func=[Var_GetAllWindowsControls]: ControlCounter=[" & $iTotalCounter & "] ControlID=[" & $sControlID & "] Handle=[" & $hControl & "] ClassNN=[" & $iCurrentClass & $iCurrentCount & "] XPos=[" & $aPos[0] & "] YPos=[" & $aPos[1] & "] Width=[" & $aPos[2] & "] Height=[" & $aPos[3] & "] Text=[" & $text & "].", False, False) ConsoleWrite("Func=[Var_GetAllWindowsControls]: 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 ;~ If $gbPerformLog Then Var_SetLogAndActOnState ( 1, $gbLogLevel_Rtrn, "Var_GetAllWindowsControls()", "Func=[Var_GetAllWindowsControls]: ControlCounter=[" & $iTotalCounter & "] ControlID=[" & $sControlID & "] Handle=[" & $hControl & "] ClassNN=[" & $iCurrentClass & $iCurrentCount & "] XPos=[winclosed] YPos=[winclosed] Width=[winclosed] Height=[winclosed] Text=[" & $text & "].", False, False) EndIf If Not WinExists($hCallersWindow) Then ExitLoop $iTotalCounter+=1 Next ;~ $giSubFunctionCounter -= 1 EndFunc of course, this assumes there is actual data present in your screenshot's control...which your screenshot does not include Edited May 23, 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...
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