Jump to content

GUICtrlCreateEdit cannot read large text file


Recommended Posts

You need to:

$edit = GUICtrlCreateEdit(FileRead(@TempDir & "\temp.txt") , 10 , 10, 522 , 205,BitOR($ES_READONLY, $WS_VSCROLL, $ES_MULTILINE))

$readme = GuiCtrlRead($edit)

MsgBox(0, "", $readme)

You need to make something read it.. I don't know why but thats how it works.]

I read it wrong.. :whistle:

How long is the file?

Edited by Secure_ICT
Link to comment
Share on other sites

  • Moderators

GUICtrlSetLimit($Control, FileGetSize($FileToRead))

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

If the text file changes after you start your script/app, can it be reloaded within the gui without restarting the script?

MsgBox(0, "", $readme)

only shows what was initially read when the script was started and does not reflect any recent changes...

Even when

$readme = FileRead ("file.txt")

Any file changes are not shown...

Edited by Teldin
Link to comment
Share on other sites

  • Moderators

@Smoke_N

i don't get it .. how do you intend to implement this ?

Thnx

Emiel

I don't intend to... the question is how do you intend to.

Now if I did ... I would put it after my creation of the edit box... unless I was doing it in a loop and checking many files... then I would do it before my GUICtrlSetData() :whistle:

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

I don't intend to... the question is how do you intend to.

Now if I did ... I would put it after my creation of the edit box... unless I was doing it in a loop and checking many files... then I would do it before my GUICtrlSetData() :whistle:

Hi SmOke_N,

i'm sorry but i really don't get it

$logfilegui = GuiCreate("LogFile",550,300)
    $edit = GUICtrlCreateEdit(FileRead(@TempDir & "\temp.txt")  , 10 , 10, 522 , 205,BitOR($ES_READONLY, $WS_VSCROLL, $ES_MULTILINE))
    GUICtrlSetLimit($edit, FileGetSize(@TempDir & "\temp.txt"))
    $LogOK = GUICtrlCreateButton ("OK",453,230,80,23,BitOr($GUI_SS_DEFAULT_BUTTON, $BS_DEFPUSHBUTTON))
    $LogPrint = GUICtrlCreateButton ("Print",373,230,80,23)
    GUISetState(@SW_SHOW, $logfilegui)
    
    While 1
        $msglogfile  = GUIGetMsg ()
        If $msglogfile = $GUI_EVENT_CLOSE or $msglogfile = $LogOK  then 
            ExitLoop
        EndIf
        Select
            case $msglogfile = $logprint
                PrintLogFile ()
        Endselect
    Wend

This still won't display a very large text file

Emiel

Best regards,Emiel Wieldraaijer

Link to comment
Share on other sites

  • Moderators

Hi SmOke_N,

i'm sorry but i really don't get it

This still won't display a very large text file

Emiel

Yeah, no kidding... you are trying to put the file in the edit box before you set the limit :whistle:

$logfilegui = GuiCreate("LogFile",550,300)
    $edit = GUICtrlCreateEdit(''  , 10 , 10, 522 , 205,BitOR($ES_READONLY, $WS_VSCROLL, $ES_MULTILINE))
    GUICtrlSetLimit($edit, FileGetSize(@TempDir & "\temp.txt"))
    GUICtrlSetData($edit, FileRead(@TempDir & "\temp.txt"))
    $LogOK = GUICtrlCreateButton ("OK",453,230,80,23,BitOr($GUI_SS_DEFAULT_BUTTON, $BS_DEFPUSHBUTTON))
    $LogPrint = GUICtrlCreateButton ("Print",373,230,80,23)
    GUISetState(@SW_SHOW, $logfilegui)
   
    While 1
        $msglogfile  = GUIGetMsg ()
        If $msglogfile = $GUI_EVENT_CLOSE or $msglogfile = $LogOK  then
            ExitLoop
        EndIf
        Select
            case $msglogfile = $logprint
                PrintLogFile ()
        Endselect
    Wend
Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

@SmOke_N

i could kiss you .. if you were a woman ..

:) ... Yeah ... Keep your lips to yourself!! :)

...

:whistle: Have a cute sister that's not jail bait? :lol: J/K

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...