guinness Posted May 23, 2013 Share Posted May 23, 2013 klerindias, This line looks wrong to me: Local $sText = ControlGetText($hWnd, '', '[CLASS:CalcFrame; INSTANCE:1]') On my Calculator the result control is CLASS:Edit - what you have in that line is the overall GUI class. Based on your last screenshot, you might want to try this: Local $sText = ControlGetText($hWnd, '', '[CLASS:#327701; INSTANCE:2]') Any luck? M23 In Windows 7 this is what Au3Info returned. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
klerindias Posted May 23, 2013 Author Share Posted May 23, 2013 No luck, and no clue whats going on going reboot computer. Link to comment Share on other sites More sharing options...
olo Posted May 23, 2013 Share Posted May 23, 2013 No luck, and no clue whats going on going reboot computer. Post what OS ur using from the control panel system specs. As its a pretty easy script you want so must be the OS ur using. Link to comment Share on other sites More sharing options...
klerindias Posted May 23, 2013 Author Share Posted May 23, 2013 Operating System Microsoft Windows 7 Professional 64-bit SP1 Computer type: Notebook Installation Date : 2010-01-30 21:25:51 Windows Security Center User Account Control (UAC) Enabled Notify level 2 - Default Firewall Enabled Windows Update AutoUpdate Notify prior to download Windows Defender Windows Defender Disabled Antivirus Antivirus Enabled Company Name Microsoft Display Name Microsoft Security Essentials Product Version 4.2.223.1 Virus Signature Database Up to date .NET Frameworks installed v4.0 Full v4.0 Client v3.5 SP1 v3.0 SP2 v2.0 SP2 Link to comment Share on other sites More sharing options...
olo Posted May 23, 2013 Share Posted May 23, 2013 Operating System Microsoft Windows 7 Professional 64-bit SP1 Computer type: Notebook Installation Date : 2010-01-30 21:25:51 Windows Security Center User Account Control (UAC) Enabled Notify level 2 - Default Firewall Enabled Windows Update AutoUpdate Notify prior to download Windows Defender Windows Defender Disabled Antivirus Antivirus Enabled Company Name Microsoft Display Name Microsoft Security Essentials Product Version 4.2.223.1 Virus Signature Database Up to date .NET Frameworks installed v4.0 Full v4.0 Client v3.5 SP1 v3.0 SP2 v2.0 SP2 whats the theme you have on it? Link to comment Share on other sites More sharing options...
klerindias Posted May 23, 2013 Author Share Posted May 23, 2013 classic Link to comment Share on other sites More sharing options...
guinness Posted May 23, 2013 Share Posted May 23, 2013 I just tested my code and the ControlGetText doesn't work, even though Au3Info displays the correct control id. olo 1 UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
olo Posted May 23, 2013 Share Posted May 23, 2013 classic what mode is the calculator in? Link to comment Share on other sites More sharing options...
klerindias Posted May 23, 2013 Author Share Posted May 23, 2013 (edited) standard Edited May 23, 2013 by klerindias Link to comment Share on other sites More sharing options...
klerindias Posted May 23, 2013 Author Share Posted May 23, 2013 I just tested my code and the ControlGetText doesn't work, even though Au3Info displays the correct control id. So need another function? Link to comment Share on other sites More sharing options...
olo Posted May 23, 2013 Share Posted May 23, 2013 So need another function? I tried it myself there and same problem somethings wrong with that controlgettext Link to comment Share on other sites More sharing options...
klerindias Posted May 23, 2013 Author Share Posted May 23, 2013 So which another function i should use to make it work? Link to comment Share on other sites More sharing options...
jdelaney Posted May 23, 2013 Share Posted May 23, 2013 (edited) EDIT: note, my calculator doesn't look like the screenshot of OP, but the OP can use the function I have provided, and use the handle of their 'sub window'...that will output all the sub controls, and they can then find their proper ID to grab the text Class #32770 is found on stuff like popups...so i think it's basically a window in a window...surprisingly, using that handle of that 'window' in WinGetText does return the value...so there you go. $hControl = controlgethandle("Calculator", "", "[CLASS:#32770; INSTANCE:1]") $test = WinGetText($hControl) ConsoleWrite($test & @CRLF) even cooler, you actually can grab the sub controls of that window: $hControl = controlgethandle("Calculator", "", "[CLASS:#32770; INSTANCE:1]") $test = WinGetText($hControl) $test2 = WinGetClassList($hControl) ConsoleWrite($test & @CRLF) ConsoleWrite($test2 & @CRLF) there are 4 statics in it AAANNNNND done: expandcollapse popup$hControl = controlgethandle("Calculator", "", "[CLASS:#32770; INSTANCE:1]") $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 Func=[Var_GetAllWindowsControls]: ControlCounter=[1] ControlID=[404] Handle=[0x00030AB2] ClassNN=[static1] XPos=[15] YPos=[13] Width=[182] Height=[13] Text=[]. Func=[Var_GetAllWindowsControls]: ControlCounter=[2] ControlID=[401] Handle=[0x00030AAC] ClassNN=[static2] XPos=[11] YPos=[35] Width=[14] Height=[18] Text=[].Func=[Var_GetAllWindowsControls]: ControlCounter=[3] ControlID=[150] Handle=[0x00030AAA] ClassNN=[static3] XPos=[29] YPos=[25] Width=[167] Height=[28] Text=[75]. Func=[Var_GetAllWindowsControls]: ControlCounter=[4] ControlID=[158] Handle=[0x00030A88] ClassNN=[static4] XPos=[29] YPos=[28] Width=[167] Height=[30] Text=[]. to get the text: $hControl = controlgethandle("Calculator", "", "[CLASS:#32770; INSTANCE:1]") $hSubControl = ControlGetHandle($hControl, "", 150) $sSubText = ControlGetText($hControl, "", $hSubControl) ConsoleWrite($sSubText & @CRLF) 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...
guinness Posted May 23, 2013 Share Posted May 23, 2013 The word convoluted comes to mind. Thanks jdelaney for solving. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
klerindias Posted May 23, 2013 Author Share Posted May 23, 2013 Where is output from ConsoleWrite? from help: Local $var = "Test" ConsoleWrite("var=" & $var & @CRLF) ; Running this in a text editor which can trap console output should produce "var=Test" I found F8 output, but there is nothing after i run script: $hControl = controlgethandle("Calculator", "", "[CLASS:#32770; INSTANCE:1]") $hSubControl = ControlGetHandle($hControl, "", 150) $sSubText = ControlGetText($hControl, "", $hSubControl) ConsoleWrite($sSubText & @CRLF) Link to comment Share on other sites More sharing options...
jdelaney Posted May 23, 2013 Share Posted May 23, 2013 (edited) EDIT: note, my calculator doesn't look like the screenshot of OP, but the OP can use the function I have provided, and use the handle of their 'sub window'...that will output all the sub controls, and they can then find their proper ID to grab the text That's the second 'code' box I provided, above. 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 Got something like this: (14) : ==> Unknown function name.: _ArraySort($aClassList) ^ ERROR Link to comment Share on other sites More sharing options...
jdelaney Posted May 23, 2013 Share Posted May 23, 2013 (edited) #include <Array.au3> add on top of script, re-run 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...
Moderators Melba23 Posted May 23, 2013 Moderators Share Posted May 23, 2013 klerindias, Add #include Array.au3 at the top of your script - that function is held in one of the standard AutoIt include files. M23 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 Link to comment Share on other sites More sharing options...
klerindias Posted May 23, 2013 Author Share Posted May 23, 2013 Now i got this: (35) : ==> Unknown function name.: $sControlID = _WinAPI_GetDlgCtrlID($hControl) $sControlID = ^ ERROR 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