Sampath Posted September 20, 2014 Posted September 20, 2014 (edited) Hi all, I'm new to this forum and newbie to Autoit (I'm learning autoit these days ). is it possible to use autoit to extract texts from a 3rd party software window? i tried with "Autoit window info" tool and it doesn't identify the texts inside the window. I'm not sure it's possible to use "WinGetText" to identify them . here i have attached both software window which i want to extract texts and "Autoit window info" for relevant window software window here i want to extract list of texts which are in white space. there are more texts when scrolling down and i want to get all of them http://imgur.com/XpZmtNk this is the "Autoit window info" for the above window http://imgur.com/KjGvl6D Edited September 20, 2014 by Sampath
jdelaney Posted September 20, 2014 Posted September 20, 2014 Was the info tool output while focused on the text you want to grab? I'm not seeing any control data, which is what you would need to key off of to grab your data. If you were focused properly, then you will probably need to UIAutomation (go to the example scripts forum, it's the first link). It looks like a listview, so also look into the _GuiCtrlListView* funcs. 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.
Sampath Posted September 20, 2014 Author Posted September 20, 2014 thanks very much jdelaney it does not given me control data.i think that's because of i login to that software through a VPN. i'll log with Direct connection and try to get Control data. let you know the progress. thanks again
Bert Posted September 20, 2014 Posted September 20, 2014 (edited) You need to use the IE.au3 tools. Look in the help file for IE.au3. You are asking to capture data on a web page so you have to use the IE tools. If you use Firefox you will need to look in the forum for FF.au3. Edited September 20, 2014 by DarthCookieMonster The Vollatran project My blog: http://www.vollysinterestingshit.com/
jdelaney Posted September 20, 2014 Posted September 20, 2014 (edited) Ah, yes, your script will need to run directly on the station, if you want it to be reliable. Lots of ways to do so...initiate the script via PAEXEC|PSEXEC|scheduled tasks, etc. Else, you would have to do all coordinate based actions (VERY inaccurate/ not reliable), and OCR to attempt to grab the text. The best OCR I've seen is about 85% accurate, so not the best route to go. Interacting directly with the controls will be 100% accurate, if scripted properly. Edited September 20, 2014 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.
Sampath Posted September 23, 2014 Author Posted September 23, 2014 Ah, yes, your script will need to run directly on the station, if you want it to be reliable. Lots of ways to do so...initiate the script via PAEXEC|PSEXEC|scheduled tasks, etc. Else, you would have to do all coordinate based actions (VERY inaccurate/ not reliable), and OCR to attempt to grab the text. The best OCR I've seen is about 85% accurate, so not the best route to go. Interacting directly with the controls will be 100% accurate, if scripted properly. thanks again for your reply. I'm bit struggling with the codes. here i have attached all the details relevant to the window. i want to get test in that window to text or excel file. i tried with following code but it doesn't give any outcome #include <MsgBoxConstants.au3> Example() Func Example() ; Retrieve the window text of the active window. controlfocus("[CLASS:TListBox]","","[ID:1771038]") Local $sText = ControlGetText("[Class:TListBox]","","[ID:1771038]") ; Display the window text. MsgBox($MB_SYSTEMMODAL, "", $sText) EndFunc ;==>Example here i tried to get them in to msgbox. but actually i want them to get to text or excel file. could you please suggest me the code which will extract the texts thanks
MikahS Posted September 23, 2014 Posted September 23, 2014 (edited) You can see in your thumbnail that their is no read text from the window. Check the hidden text and see if that is where the text you want is. Then, You'll need to use Opt("WinDetectHiddenText", 1) Local $text, $open, $write $text = ControlGetText("[ACTIVE]", "", "[CLASS:TListBox; Instance: 1]") $open = FileOpen(@WorkingDir & "\exampleFileName", 2) ; open the file in write mode this will create the file if it does not exist $write = FileWrite($open, $text) ; write the text contents from the window to the file FileClose($open) ; close the file Hopefully that gives a little understanding Edited September 23, 2014 by MikahS Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ
Sampath Posted September 23, 2014 Author Posted September 23, 2014 thanks very much.here i have attached bottom part of the "autoit window info". but it has not recognized the texts(those are in white color space) which i want to extract either in visible or hidden text. but i selected the correct area when freezing the "autoit window info". is autoit cannot extract those texts which not identify as visible or hidden text ?thanks
BrewManNH Posted September 23, 2014 Posted September 23, 2014 Instead of screenshotting the Info tool, go to the summary tab and copy the text from it and paste it here. It will give us all of the information on the tab instead of half of it at a time. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
Solution jdelaney Posted September 23, 2014 Solution Posted September 23, 2014 (edited) Use the ListBox functions to select, and get, text: _GUICtrlListBox_SelectString example: #include <GuiListBox.au3> $hControl = ControlGetHandle("[CLASS:TFormProductRoutingCheck]", "", "[CLASS:TListBox; Instance:1]") $iCount = _GUICtrlListBox_GetCount($hControl) ConsoleWrite("$iCount=" & $iCount & @CRLF) For $i = 0 To $iCount-1 $text = _GUICtrlListBox_GetText($hWnd, $i) ConsoleWrite("text[" & $i & "]=" & $text & @CRLF) Next Edited September 23, 2014 by jdelaney MikahS 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.
Sampath Posted October 2, 2014 Author Posted October 2, 2014 thanks very much jdelaney and all others who replied to this thread.i could solve the problem with guideline of jdelaney
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