Sign in to follow this  
Followers 0
Emiel Wieldraaijer

GUICtrlCreateEdit cannot read large text file

11 posts in this topic

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



#2 ·  Posted (edited)

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

Large

1MB is nothing

Emiel


Best regards,Emiel Wieldraaijer

Share this post


Link to post
Share on other sites

GUICtrlSetLimit($Control, FileGetSize($FileToRead))


[center]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.[/center]

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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

@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

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:


[center]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.[/center]

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

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

[center]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.[/center]

Share this post


Link to post
Share on other sites

@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

#11 ·  Posted (edited)

@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

[center]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.[/center]

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