sonofalion Posted October 1, 2008 Share Posted October 1, 2008 Hi all,first question in this forum, please don't give me the "Please read the tutorials", done that already.So, what I am trying to do is open a Putty terminal (where logging is enabled), throw some commands, and watch the terminal output on an Edit box I have on my GUI.I'm using:$script_log = GUICtrlCreateEdit("", 104, 360, 425, 81)$hps2_log = FileOpen("C:\Program Files\PuTTY Connection Manager\hps2.log", 0) ; check if file opened for reading OK If $hps2_log = -1 Then MsgBox(0, "Error", "Please check that Putty logging is enabled for this session.") Exit EndIf ; check if file creation is successful $hps2_log_read = FileRead($hps2_log)GUICtrlSetData($script_log, $hps2_log_read) But this will only print the output from the terminal up to the specific point in the code. I want it to update continuously.If I put it in a while loop, it just refreshes so fast that it is rendered invisible. I want my Edit box to append any new info from the Putty log at any time. How is this possible? Link to comment Share on other sites More sharing options...
Zedna Posted October 1, 2008 Share Posted October 1, 2008 Post your code with Loop. I will fix it so it will not flicker. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
sonofalion Posted October 1, 2008 Author Share Posted October 1, 2008 You mean? $script_log = GUICtrlCreateEdit("", 104, 360, 425, 81) $hps2_log = FileOpen("C:\Program Files\PuTTY Connection Manager\hps2.log", 0) ; check if file opened for reading OK If $hps2_log = -1 Then MsgBox(0, "Error", "Please check that Putty logging is enabled for this session.") Exit EndIf ; check if file creation is successful While 1 $hps2_log_read = FileRead($hps2_log) GUICtrlSetData($script_log, $hps2_log_read) WEnd This will update every millisecond or so. Wouldn't it be a problem? Isn't there a way to have a loop which reads the input from a file (when new input is feeded) and appends every new line to another file? Thanks for your help! Link to comment Share on other sites More sharing options...
Zedna Posted October 1, 2008 Share Posted October 1, 2008 The simplest way: $script_log = GUICtrlCreateEdit("", 104, 360, 425, 81)$hps2_log = FileOpen("C:\Program Files\PuTTY Connection Manager\hps2.log", 0) ; check if file opened for reading OK If $hps2_log = -1 Then MsgBox(0, "Error", "Please check that Putty logging is enabled for this session.") Exit EndIf ; check if file creation is successful Dim $hps2_log_read, $hps2_log_read_prev While 1 $hps2_log_read = FileRead($hps2_log) If $hps2_log_read <> $hps2_log_read_prev Then GUICtrlSetData($script_log, $hps2_log_read) $hps2_log_read_prev = $hps2_log_read EndIf WEnd Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
sonofalion Posted October 1, 2008 Author Share Posted October 1, 2008 Great touch! I was thinking of comparing lines between the log and the Edit Box and appending the extra lines. But this is simpler and cleverer. Many 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