Ветеран
Сообщения: 27449
Благодарности: 8087
|
Профиль
|
Отправить PM
| Цитировать
Пробуйте:
читать дальше »
Код: 
Option Explicit
Dim strSourceFile
Dim arrContent
Dim strLine
strSourceFile = "E:\Песочница\0374\text.txt"
With WScript.CreateObject("Scripting.FileSystemObject")
If .FileExists(strSourceFile) Then
With .OpenTextFile(strSourceFile)
arrContent = Split(.ReadAll(), vbCrLf)
.Close
End With
With WScript.CreateObject("VBScript.RegExp")
.IgnoreCase = True
For Each strLine In arrContent
.Pattern = "^Имя Сотрудника.*(Вася|Петя).*$"
If .Test(strLine) Then
WScript.Echo "действие 1"
End If
.Pattern = "^Имя Сотрудника.*Иван.*$"
If .Test(strLine) Then
WScript.Echo "действие 2"
End If
Next
End With
Else
WScript.Echo "Source file [" & strSourceFile & "] not found."
WScript.Quit 1
End If
End With
WScript.Quit 0
|
Отправлено: 09:39, 17-04-2014
| #2
|