#include <Constants.au3>
Dim $i
$ADSL =IniRead("C:\ADSL.ini", "ADSL", "LAN", "")
$us =IniRead("C:\ADSL.ini", "ADSL", "USERNAME", "")
$ps =IniRead("C:\ADSL.ini", "ADSL", "PASSWD", "")
a()
Func a()
Sleep(1000)
$foo = Run(@ComSpec & " /c ipconfig", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
Sleep(500)
While 1
$line = StdoutRead($foo)
If @error Then ExitLoop
$i = $line
Sleep(200)
WEnd
If StringInStr ($i,"PPP adapter ADSL:") = 0 Then
b()
Else
Sleep(29000)
a()
EndIf
EndFunc
func b()
if FileExists("c:\adslup.txt") Then
$file = FileOpen("c:\adslerr.txt",1)
$time = @year& "-"&@mon &"-"&@MDAY&"-"& @hour & ":" & @MIN &":" & @SEC
FileWrite($file,"斷線時間:"& $time&@CRLF)
FileClose($file)
Else
$file1 = FileOpen("c:\adslup.txt",1)
FileClose($file1)
EndIf
runWait("C:\WINDOWS\system32\rasdial.exe"&" "&$ADSL&" "&$us&" "&$ps ,"C:\WINDOWS\system32")
Sleep(5000)
a()
EndFunc
|