mentosan Posted July 17, 2008 Share Posted July 17, 2008 I'm having this code : #include <file.au3> Dim $ipfile="host.txt" Dim $ipaddress _FileReadToArray ($ipfile, $ipaddress) $handle=fileopen(@ScriptDir & "\host.txt",0) $MyLine=filereadline($handle) fileclose($handle) $SplitArr=StringSplit($MyLine," ") $IP=$SplitArr[1] Select Case Ping ($IP) Run ("telnet -f log_telnet.txt") WinActivate("system32") WinWaitActive("system32") Send ("open " & $ipaddress[1] & "{Enter}") Send ("{Enter}") While 1 Sleep (2000) ControlSend ("Telnet","","","x" & "{Enter}") Wend Case Else MsgBox(0,"Info -" & $IP, "No ping", 3) EndSelect The script will connect to a telnet session and will execute a command in a loop, every 2 secs. But first it will check if ping is OK, otherwise it will return an error message for 3 seconds and then it will exit. The problem is, in this case, I don't want the script to exit. I want to restart the pinging (beginning of the script). I'm using "Select...Case" but unsuccesful. Please help Link to comment Share on other sites More sharing options...
martin Posted July 17, 2008 Share Posted July 17, 2008 I'm having this code : #include <file.au3> Dim $ipfile="host.txt" Dim $ipaddress _FileReadToArray ($ipfile, $ipaddress) $handle=fileopen(@ScriptDir & "\host.txt",0) $MyLine=filereadline($handle) fileclose($handle) $SplitArr=StringSplit($MyLine," ") $IP=$SplitArr[1] Select Case Ping ($IP) Run ("telnet -f log_telnet.txt") WWinActivate("system32") WinWaitActive("system32") Send ("open " & $ipaddress[1] & "{Enter}") Send ("{Enter}") While 1 Sleep (2000) ControlSend ("Telnet","","","x" & "{Enter}") Wend Case Else MsgBox(0,"Info -" & $IP, "No ping", 3) EndSelect The script will connect to a telnet session and will execute a command in a loop, every 2 secs. But first it will check if ping is OK, otherwise it will return an error message for 3 seconds and then it will exit. The problem is, in this case, I don't want the script to exit. I want to restart the pinging (beginning of the script). I'm using "Select...Case" but unsuccesful. Please helpYou could just have while 1 Select . . EndSelect Wend Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. 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