Ветеран
Сообщения: 27449
Благодарности: 8087
|
Профиль
|
Отправить PM
| Цитировать
ultrarare, на WSH:
читать дальше »
Код: 
Option Explicit
Const ForReading = 1
Const ForWriting = 2
Dim strFile
Dim strPattern
Dim objFSO
Dim strProxyS
Dim strContent
strFile = "E:\Песочница\0288\list.txt"
Set objFSO = WScript.CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(strFile) Then
With objFSO.OpenTextFile(strFile, ForReading)
strContent = .ReadAll()
.Close
End With
With WScript.CreateObject("VBScript.RegExp")
.Pattern = "^(ProxyS=)(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$"
.IgnoreCase = True
.MultiLine = True
If .Test(strContent) Then
strProxyS = Trim(InputBox("Change ProxyS value:", "ProxyS", .Execute(strContent).Item(0).Submatches(1)))
If Len(strProxyS) > 0 Then
strContent = .Replace(strContent, "$1" & strProxyS)
With objFSO.OpenTextFile(strFile, ForWriting)
.Write strContent
.Close
End With
End If
Else
WScript.Echo "Can't find any line in file [" & strFile & "] for pattern [" & .Pattern & "]."
End If
End With
Else
WScript.Echo "Can't find file [" & strFile & "]."
End If
WScript.Quit 0
Проверка — является ли введённое значение IP-адресом — не производится.
|
Отправлено: 08:07, 03-07-2013
| #4
|