while loop times out?
#1
Posted 02 November 2011 - 09:45 PM
$file = fileopen($PuttyLogpath,0)
Local $str = FileReadLine($file, -1)
while $str <> $Message
sleep(200)
$str = FileReadLine($file, -1)
WEnd
<It Shall Be Done>
#2
Posted 02 November 2011 - 09:49 PM
Edited by Jos, 02 November 2011 - 09:49 PM.
Visit the SciTE4AutoIt3 Download page for the latest versions Forum Rules
Live for the present,
Dream of the future,
Learn from the past.
#3
Posted 02 November 2011 - 09:54 PM
No.do while loops in Autoit time out after a while?
By the way, I am none too sure that you will ever get out of your loop as you might be locking the file when you open it and so it can never be re-read.
I found that this worked better:
$Message = "End" $file = "test.txt" Local $str = FileReadLine($file, -1) While $str <> $Message Sleep(200) $str = FileReadLine($file, -1) ConsoleWrite($str & @CRLF) WEnd
Any help?
M23
Toast - Small GUIs which pop out of the Systray   Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI   NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure   Notify - Small notifications on the edge of the display
RecFileListToArray- An alternative to _FileListToArray with user-defined include/exclude masks, maximum recursion level, sorting and displayed path options
GUIListViewEx - Insert, delete, move, drag and sort ListView items
#4
Posted 02 November 2011 - 10:01 PM
$file = fileopen($PuttyLogpath, 0) Local $str = FileReadLine($file, -1) while $str <> $Message sleep(200) $str = FileReadLine($file, -1) if @error<> 0 then ExitLoop; tests for EOF WEnd ConsoleWrite(@CRLF&"program exited loop")
Edited by songersoft, 02 November 2011 - 10:02 PM.
The Humpty dance, Megadeth - Countdown To Extinction, Metallica - Blackened, The Sound of Urchin - Zen Magic Marker
Unless someone like you cares a whole awful lot, nothing is going to get better. It's just not.
#5
Posted 02 November 2011 - 10:05 PM
Why does he need to test for EOF? With the "line" parameter set to -1, the code is always reading the last line so there will never be an EOF return.
M23
Toast - Small GUIs which pop out of the Systray   Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI   NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure   Notify - Small notifications on the edge of the display
RecFileListToArray- An alternative to _FileListToArray with user-defined include/exclude masks, maximum recursion level, sorting and displayed path options
GUIListViewEx - Insert, delete, move, drag and sort ListView items
#6
Posted 02 November 2011 - 10:07 PM
The Humpty dance, Megadeth - Countdown To Extinction, Metallica - Blackened, The Sound of Urchin - Zen Magic Marker
Unless someone like you cares a whole awful lot, nothing is going to get better. It's just not.
#7
Posted 02 November 2011 - 10:21 PM
here are some of my custom functions, I have Putty output the results in a txt file on my desktop so I can interact with it
StartPutty($Puttypath, "db5")
ReadLog($PuttyLogpath, "[company@db5.prod ~]$ ")
sending("./generate_mtu_data.sh apps") //this is the query that will take 2 minutes to run
ReadLog($PuttyLogpath, "[company@db5.prod ~]$ ")
blah
blah
<It Shall Be Done>
#8
Posted 02 November 2011 - 10:27 PM
Edited by czardas, 02 November 2011 - 10:32 PM.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users



