지정된 문서내용 및 찾고자 하는 목록을 모두 읽어서 변수에 넣은 다음에 찾고자하는 단어를 리턴을 기준으로 배열을 만든 다음에 루프를 돌려서 찾는 스크립트 입니다.
Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\Scripts\문서파일.txt", ForReading)
strContents = objFile.ReadAll
objFile.Close
Set objFile = objFSO.OpenTextFile("C:\Scripts\단어목록.txt", ForReading)
strSearchTerms = objFile.ReadAll
objFile.Close
arrSearchTerms = Split(strSearchTerms, vbCrLf)
For Each strItem in arrSearchTerms
intFound = InStr(strContents, strItem)
If intFound = 0 Then
Wscript.Echo "The search term " & strItem & " was not found."
End If
Next
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\Scripts\문서파일.txt", ForReading)
strContents = objFile.ReadAll
objFile.Close
Set objFile = objFSO.OpenTextFile("C:\Scripts\단어목록.txt", ForReading)
strSearchTerms = objFile.ReadAll
objFile.Close
arrSearchTerms = Split(strSearchTerms, vbCrLf)
For Each strItem in arrSearchTerms
intFound = InStr(strContents, strItem)
If intFound = 0 Then
Wscript.Echo "The search term " & strItem & " was not found."
End If
Next
찾고자 하는 텍스트 문서 예제
'Curiouser and curiouser!' cried Alice (she was so much surprised, that
for the moment she quite forgot how to speak good English); 'now I'm
opening out like the largest telescope that ever was! Good-bye, feet!'
(for when she looked down at her feet, they seemed to be almost out of
sight, they were getting so far off). 'Oh, my poor little feet, I wonder
who will put on your shoes and stockings for you now, dears? I'm sure
_I_ shan't be able! I shall be a great deal too far off to trouble myself
about you: you must manage the best way you can; --but I must be kind to
them,' thought Alice, 'or perhaps they won't walk the way I want to go!
Let me see: I'll give them a new pair of boots every Christmas.'
찾고자 하는 단어 목록
boots
hat
pants
shirt
shoes
telescope
03-TechNetB_masthead_ltr.gif
댓글 없음:
댓글 쓰기