Sign in to follow this  
Followers 0
KarlosTHG

String Max Capacity?

11 posts in this topic

Hi guys, i'm trying to get the text of a window to parse this and get some parts but when it has more 32kb of text, cannot get the entire text, what can i do?

sorry for my english :)

Share this post


Link to post
Share on other sites



Hi,

what function do you use?

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Indeed, WinGetText() has a limit of 32 kb, not 64 as remarked in the help file:

#include <GUIConstantsEx.au3>
#include <EditConstants.au3>
;

$GUI = GUICreate("Test Script", 300, 200)

$nEdit = GUICtrlCreateEdit("", 20, 40, 260, 120)
GUICtrlSendMsg($nEdit, $EM_LIMITTEXT, -1, 0) ;This one will remove the text limit in Edit control

$sData = ""

For $i = 1 To (32 * 1024) + 100 ;32768 + 100 = 32868
    $sData &= "a"
Next

GUICtrlSetData($nEdit, $sData)

GUISetState(@SW_SHOW, $GUI)

$sWinGetText_Data = WinGetText($GUI)
$sControlGetText_Data = ControlGetText($GUI, "", "Edit1")
$sGUICtrlRead_Data = GUICtrlRead($nEdit)

MsgBox(48, "*GetText Test", _
    StringFormat("WinGetText()\t\t= %i -> Limited up to 32kb? (32 * 1024 = 32768)\nControlGetText()\t\t= %i\nGUICtrlRead()\t\t= %i", _
        StringLen($sWinGetText_Data), StringLen($sControlGetText_Data), StringLen($sGUICtrlRead_Data)))

Or it's a wrong check?

Edited by MrCreatoR

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

It's about unicode, so 64KB is ok to say.

Interesting thing is that the limit is set not with used function SendMessageW(WM_GETTEXT) but later on. Buffer is filled fully for every control and truncated afterwards.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

hi again, thanks for your interest but nobody has an idea to bypass this problem, this is an example for understand me better:

i load a program

this program has a control (edit, label)

this control has so many text, over 100k

i need to get that text in my script and parse it to get some parts

autoit get the text but only 32k and the other text is missing

maybe with APIs or a dll

someone has an idea

Share this post


Link to post
Share on other sites

yes im sorry but this pc is behind a proxy and that proxy show me and error and i think the message was not send

Share this post


Link to post
Share on other sites

yes im sorry but this pc is behind a proxy and that proxy show me and error and i think the message was not send

Maybe you could use the message EM_GETLINECOUNTand then get every line in a loop using EM_GETLINE.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Maybe you could use the message EM_GETLINECOUNTand then get every line in a loop using EM_GETLINE.

ok, i will to test it, thanks

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

ok, i will to test it, thanks

I think it will work. I had a quick play like this, (apologioes for messy script modified from MrCreatoR's, but I'm off to bed!)

#include <GUIConstantsEx.au3>
  #include <EditConstants.au3>
  #include <SendMessage.au3>
;
  
  $GUI = GUICreate("Test Script", 300, 200)
  
  $nEdit = GUICtrlCreateEdit("", 20, 40, 260, 120)
  GUICtrlSendMsg($nEdit, $EM_LIMITTEXT, -1, 0);This one will remove the text limit in Edit control
  
  $sData = ""
  
  For $i = 1 To 33
      for $j = 1 to 1023;(32 * 1024) + 100;32768 + 100 = 32868
      $sData &= "a"
  Next
  $sData &= @CRLF
  Next
  
  GUICtrlSetData($nEdit, $sData)
  
  GUISetState(@SW_SHOW, $GUI)
  
  $sWinGetText_Data = WinGetText($GUI)
  $sControlGetText_Data = ControlGetText($GUI, "", "Edit1")
  $sGUICtrlRead_Data = GUICtrlRead($nEdit)
  
  MsgBox(48, "*GetText Test", _
      StringFormat("WinGetText()\t\t= %i -> Limited up to 32kb? (32 * 1024 = 32768)\nControlGetText()\t\t= %i\nGUICtrlRead()\t\t= %i", _
          StringLen($sWinGetText_Data), StringLen($sControlGetText_Data), StringLen($sGUICtrlRead_Data)))
  
      $LInes =  _SEndmessage(controlgethandle($gui,"",$nEdit),$EM_GETLINECOUNT)
      ConsoleWrite($lines & @CRLF)
  
      $sbuf = DllStructCreate("char[3000]");set to some length more than expected line length
      $sTC = dllstructcreate("wchar",DllStructGetPtr($sBuf))
      dllstructsetdata($sTC,1,3000)
      $chars = _SendMessage(controlgethandle($gui,"",$nEdit),$EM_GETLINE,32,dllstructgetptr($sbuf));read line 33
      ConsoleWrite($chars & @CRLF);the no of chars returned
  ConsoleWrite(Dllstructgetdata($sBuf,1) & @CRLF);the line read

EDIT: This is not needed due to my misunderstanding of MrCreatoR's example above (post #3), so it is better to use ControlGetText.

Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

hi again, thanks for your interest but nobody has an idea to bypass this problem, this is an example for understand me better:

i load a program

this program has a control (edit, label)

this control has so many text, over 100k

i need to get that text in my script and parse it to get some parts

autoit get the text but only 32k and the other text is missing

maybe with APIs or a dll

someone has an idea

But what about ControlGetText(), it's has no limit as far as i tested (with 100 kb as well)...

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

But what about ControlGetText(), it's has no limit as far as i tested (with 100 kb as well)...

Oh, I thought your script was showing that the same limit applied. In that case ignore my post.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0