Mirage Posted August 8, 2007 Share Posted August 8, 2007 Hi guys. I've got a script with a pretty simple gui that I used for logging/debugging output. Func StartGui() $gui = GUICreate("Output", 600, 500, 700, 800, $WS_EX_TOPMOST) ; will create a dialog box that when displayed is centered WinSetOnTop($gui, "",1) $status = GUICtrlCreateEdit("", 0,10,590,480, -1) GUISetState (@SW_SHOW) EndFunc ;; ------------------------------------- ;; Logit() ;; ------------------------------------- ;; This function logs to the GUI and hopefully file Func Logit($string) Local $logfile = 'C:/data/logfile.txt' Local $date = @MDAY & "-" & @MON & "-" & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC Local $message = $date & " " & $string $file = FileOpen($logfile, 9) FileWrite($file, $message & @CRLF) FileClose($file) GUICtrlSetData($status,$message & @CRLF,1) Sleep(100) EndFunc My issue is that the editbox gets full and stops logging. Is there some way I can specify that I only want the last X lines? Cheers Link to comment Share on other sites More sharing options...
mikehunt114 Posted August 8, 2007 Share Posted August 8, 2007 For something like this, maybe it would be better to use a List. IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font] Link to comment Share on other sites More sharing options...
Mirage Posted August 8, 2007 Author Share Posted August 8, 2007 For something like this, maybe it would be better to use a List.I initially was using a list, however the issue I had was that as the log was generated the window wouldn't scroll down. The output made it there, but all the output was scrolling below in the listbox.If there's some way to tell Autoit to go to the last one on an edit that would be great. Link to comment Share on other sites More sharing options...
mikehunt114 Posted August 8, 2007 Share Posted August 8, 2007 How about adding to the top? You can use _GUICtrlListInstertItem with an index of 0 to append a new entry to the beginning. This is how I make my loggers. IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font] Link to comment Share on other sites More sharing options...
Mirage Posted August 9, 2007 Author Share Posted August 9, 2007 How about adding to the top? You can use _GUICtrlListInstertItem with an index of 0 to append a new entry to the beginning. This is how I make my loggers.Ah excellent, this is what I was after. Thanks. 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