Iceburg 1 Posted August 8, 2010 I have a script that runs 24/7 doing a variety of automation tasks for me. I have set up a On-Click GUI to change what the script is doing, and a small logging window associated with it. Basically the only thing that I have an issue with is my display logging in the GUI. I have the following code, which is working fine, and in the 2nd day sometime I have iMemo get to the limit of 4096 lines. I have a button that clears iMemo but I miss all that logging while its full. Is there a way to create iMemo so as it gets to 4096 lines, the first line rolls off, and the new line is added so I can always see the past 4096 lines, and not the first 4096 lines that filled it up? $iMemo = GUICtrlCreateEdit("",245, 5, $GUIWidth - 240, $GuiHeight - 10, $ES_READONLY + $ES_MULTILINE + $ES_AUTOVSCROLL + $WS_VSCROLL) GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New") GUICtrlSetData($iMemo, "(" & _Now() & ") Initializing..." & @CRLF, 2) GUISetState(@SW_SHOW, $GUI) Share this post Link to post Share on other sites
Realm 18 Posted August 8, 2010 I was looking over all the built in functions with edit controls, and could not find a simple step to your problem. However after playing with it for a bit, I think I have a rudimentary solution. instead of limiting to 4096, I made mine for 10 lines to check it. here is my entire write, I hope it helps, Or someone comes up with a better solution for you. expandcollapse popup#include<date.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> #include<string.au3> #include<file.au3> #include <GuiEdit.au3> $GUIWidth=800 $GuiHeight=600 $GUI=GUICreate("Example",$GUIWidth,$GuiHeight) $iMemo = GUICtrlCreateEdit("",245, 5, $GUIWidth - 240, $GuiHeight - 10, $ES_READONLY + $ES_MULTILINE + $ES_AUTOVSCROLL + $WS_VSCROLL) GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New") GUICtrlSetData($iMemo, "(" & _Now() & ") Initializing..." & @CRLF, 2) GUISetState(@SW_SHOW, $GUI) $c=0;for my testing Do;you probably want thist to be While 1 $count=_GUICtrlEdit_GetLineCount($iMemo) If $count>=10 Then ;change this to 4096, or whatever line limit you want to set it too. This will check when your control is at limit $file=FileOpen(@TempDir & "\Temp_file.txt",2) FileWrite($file,GUICtrlRead($iMemo)) FileClose($file) $line=FileReadLine(@TempDir & "\Temp_file.txt",2) $iMsg=$line & @CRLF For $i=3 to $count-1 $line=FileReadLine(@TempDir & "\Temp_file.txt",$i) $iMsg=$iMsg & $line & @CRLF Next GUICtrlSetData($iMemo, $iMsg);this will reset your edit, and skipping line 1 otherwise deleteing it. EndIf GUICtrlSetData($iMemo, "(" & _Now() & ") Initializing..." & @CRLF,2);your function to add another line $c+=1;for my testing purpose Until $c=20;Wend While 1 Sleep(100) WEnd My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. Share this post Link to post Share on other sites
UEZ 1,272 Posted August 9, 2010 This should work: ... $iMemo = GUICtrlCreateEdit("",245, 5, $GUIWidth - 240, $GuiHeight - 10, $ES_READONLY + $ES_MULTILINE + $ES_AUTOVSCROLL + $WS_VSCROLL) GUICtrlSetLimit(-1, 0x7FFFFFFF) ... Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Share this post Link to post Share on other sites
Iceburg 1 Posted August 9, 2010 This should work: ... $iMemo = GUICtrlCreateEdit("",245, 5, $GUIWidth - 240, $GuiHeight - 10, $ES_READONLY + $ES_MULTILINE + $ES_AUTOVSCROLL + $WS_VSCROLL) GUICtrlSetLimit(-1, 0x7FFFFFFF) ... Br, UEZ You rock. I will give it a run, and we'll see in a couple days if it works. Is there anything else I need to worry about? In 60 days is my script going to crash cause its so large? I don't understand the 0x7FFFFFFF hex number. I tried to google it, and apparently we're going to die in 2038 cause of that number. =) Share this post Link to post Share on other sites