Jump to content
Sign in to follow this  
Emiel Wieldraaijer

GUICtrlCreateEdit cannot read large text file

Recommended Posts

Emiel Wieldraaijer

Hi All,

Is there another option for this

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

Because if the text file is too big .. it cannot be displayed

Thnx

Emiel


Best regards,Emiel Wieldraaijer

Share this post


Link to post
Share on other sites
James

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

Share this post


Link to post
Share on other sites
Emiel Wieldraaijer

Large

1MB is nothing

Emiel


Best regards,Emiel Wieldraaijer

Share this post


Link to post
Share on other sites
SmOke_N

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.

Share this post


Link to post
Share on other sites
Teldin

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

Share this post


Link to post
Share on other sites
Emiel Wieldraaijer

@Smoke_N

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

Thnx

Emiel


Best regards,Emiel Wieldraaijer

Share this post


Link to post
Share on other sites
SmOke_N

@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.

Share this post


Link to post
Share on other sites
Emiel Wieldraaijer

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

Share this post


Link to post
Share on other sites
SmOke_N

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.

Share this post


Link to post
Share on other sites
Emiel Wieldraaijer

@SmOke_N

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

I'm learning..

Thnx Thnx Thnx


Best regards,Emiel Wieldraaijer

Share this post


Link to post
Share on other sites
SmOke_N

@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.

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  

×