wroom Posted September 24, 2007 Share Posted September 24, 2007 I have a script that retrieves the text from an active window using the wingettext() command works fine excepting when the text exceeds its limit as described in the help file,in this situation it truncates the text (text in window is part of a application with that scrolls activity in realtime much to fast for any sort of OCR) what I am hoping for is to possibly find a way to extract all the text in the active window or extract the "bottom part of the text" the text can grow to about 400Kb somewhat larger than the 64Kb limit Link to comment Share on other sites More sharing options...
GaryFrost Posted September 24, 2007 Share Posted September 24, 2007 I have a script that retrieves the text from an active window using the wingettext() command works fineexcepting when the text exceeds its limit as described in the help file,in this situation it truncates the text (text in window is part of a application with that scrolls activity in realtime much to fast for any sort of OCR)what I am hoping for is to possibly find a way to extract all the text in the active window or extract the "bottom part of the text"the text can grow to about 400Kb somewhat larger than the 64Kb limitif it's an edit control there are ways to get what you want. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
wroom Posted September 24, 2007 Author Share Posted September 24, 2007 if it's an edit control there are ways to get what you want.Gary, Thanks for the tipYes it is a edit control and did a quick test and it appears to work ( I can extract the text from the text window)using - "WinGetHandle" function to get the handle and using the example in the help file with a few modifications got the textwith "ControlGetText" functionI have not tested it fully yet if it resolves the size limitation issue but your help appears promisingThanks Link to comment Share on other sites More sharing options...
GaryFrost Posted September 25, 2007 Share Posted September 25, 2007 Gary, Thanks for the tipYes it is a edit control and did a quick test and it appears to work ( I can extract the text from the text window)using - "WinGetHandle" function to get the handle and using the example in the help file with a few modifications got the textwith "ControlGetText" functionI have not tested it fully yet if it resolves the size limitation issue but your help appears promisingThanksif that don't work for you might look at:_GUICtrlEditGetLineCount_GUICtrlEditGetLineThe above functions may end up deprecated in the near future. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
sprawl Posted October 6, 2007 Share Posted October 6, 2007 I had the same buffer overflow problem with WinGetText(). But after reading this topic I got some new ideas which I'd like to share. Instead of reading the entire text chunk at once, try read row by row. Dim $rowCnt, $lastRow = 1, $row, $rows, While True $rowCnt = ControlCommand( "Windows-application-window-title", "", 101, "GetLineCount" ) ; I used the AutoIt Window Tool to find our the control id 101 above $rows = "" For $i=$lastRow To $rowCnt Step 1 $row = ControlCommand( "Windows-application-window-title", "", 101, "GetLine", $i ) $rows = $rows & $row Next If $lastRow < $rowCnt + 1 Then $lastRow = $rowCnt+1 EndIf Sleep( 500 ) WEnd Link to comment Share on other sites More sharing options...
GaryFrost Posted October 6, 2007 Share Posted October 6, 2007 I had the same buffer overflow problem with WinGetText(). But after reading this topic I got some new ideas which I'd like to share. Instead of reading the entire text chunk at once, try read row by row. Dim $rowCnt, $lastRow = 1, $row, $rows, While True $rowCnt = ControlCommand( "Windows-application-window-title", "", 101, "GetLineCount" ) ; I used the AutoIt Window Tool to find our the control id 101 above $rows = "" For $i=$lastRow To $rowCnt Step 1 $row = ControlCommand( "Windows-application-window-title", "", 101, "GetLine", $i ) $rows = $rows & $row Next If $lastRow < $rowCnt + 1 Then $lastRow = $rowCnt+1 EndIf Sleep( 500 ) WEnd I would think that using the ControlGetHandle and then using the following would be better then reading row by row. _GUICtrlEdit_GetLineCount _GUICtrlEdit_GetLine The above 2 functions are from the latest beta, which will work with external edit control, you should be able to retrieve and line from the edit control with-out reading the whole content. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
sprawl Posted October 7, 2007 Share Posted October 7, 2007 I would think that using the ControlGetHandle and then using the following would be better then reading row by row._GUICtrlEdit_GetLineCount_GUICtrlEdit_GetLineThe above 2 functions are from the latest beta, which will work with external edit control, you should be able to retrieve and line from the edit control with-out reading the whole content.OK.But just for some clarifcation on my script, it prevents me from getting buffer overflow. Each loop only reads the unread lines and allows me to execute logic on only those lines.By the way, when will the _<functions> be added to docs?Thanks for your support! Link to comment Share on other sites More sharing options...
GaryFrost Posted October 7, 2007 Share Posted October 7, 2007 OK.But just for some clarifcation on my script, it prevents me from getting buffer overflow. Each loop only reads the unread lines and allows me to execute logic on only those lines.By the way, when will the _<functions> be added to docs?Thanks for your support!There should be no buffer overflow with UDF functions, they use the API calls.They are already in the Beta Docs, look in the UDF section of the help file of the Beta. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
RobMac Posted October 8, 2007 Share Posted October 8, 2007 I have been searching for this but have not found an answer. What's the easiest way to get the text size in the edit Window such that we can use the WinGetText if under 64k and read line by line otherwise. For downloads of many screens / files I would think the WinGetText would run much faster. At this point I am using wingettext then looking at the file size then re-downloading / overwriting if there was a risk of cropping. Is there an easier way? Thanks. Link to comment Share on other sites More sharing options...
RobMac Posted October 8, 2007 Share Posted October 8, 2007 Actually Ignore Last Post.. What I was trying to do is not working (I was looking at the string length after WinGetText) then deciding whether to do line by line extraction and file write or simply write full text to file if it was under a threshold. Anyway, _GUICtrlEditGetLineCount and _GUICtrlEditGetLine are not working for me (and I may be using them incorrectly). I am not sure the control I am looking at is an edit control. AutoIt Window Info says the Class of the control is "RICHEDIT" - it is basically a text only result window where search results apear. 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