Ветеран
Сообщения: 27449
Благодарности: 8087
|
Профиль
|
Отправить PM
| Цитировать
registeruser1, ну, насчёт кучи — это Вы загнули:
Цитата:
<html><head><title>Current IP Check</title></head><body>Current IP Address: XXX.XXX.XXX.XXX</body></html>
|
Пробуйте:
читать дальше »
Код: 
Option Explicit
Const ForAppending = 8
Const strPreviousIPList = "PreviousIPList.txt"
Dim strIP
Dim boolIPExists
Dim objRegExp
Set objRegExp = WScript.CreateObject("VBScript.RegExp")
With objRegExp
.IgnoreCase = True
.Pattern = "<html><head><title>Current IP Check</title></head><body>Current IP Address: (\d+\.\d+\.\d+\.\d+)</body></html>"
End With
With WScript.CreateObject("Microsoft.XMLHTTP")
.open "GET", "http://checkip.dyndns.com/", False
.send
strIP = objRegExp.Execute(.responseText)(0).Submatches(0)
End With
Set objRegExp = Nothing
boolIPExists = False
With WScript.CreateObject("Scripting.FileSystemObject")
If .FileExists(strPreviousIPList) Then
With .OpenTextFile(strPreviousIPList)
Do Until .AtEndOfStream
If .ReadLine() = strIP Then
boolIPExists = True
Exit Do
End If
Loop
.Close
End With
End If
If boolIPExists Then
MsgBox "IP exists", vbOKOnly + vbExclamation, "IP exists"
Else
With .OpenTextFile(strPreviousIPList, ForAppending, True)
.WriteLine strIP
.Close
End With
MsgBox "IP [" & strIP & "] append", vbOKOnly + vbInformation, "IP append"
End If
End With
WScript.Quit 0
|
Отправлено: 00:56, 04-08-2013
| #30
|