I have an input file like this:
**********************************************************
* NAME : CONTROLLER
* FUNCTION : NOTHING IMPORTANT
* BEGIN DATE : 31/07/13
* TIME BEGIN : 23.39.17.75
**********************************************************
* DATA INPUT READ : 000000540
**********************************************************
* NAME : CONTROLLER
* FUNCTION : NOTHING IMPORTANT
* BEGIN DATE : 28/04/13
* TIME BEGIN : 22.19.35.22
**********************************************************
* DATA INPUT READ : 000008940
**********************************************************
I want take the date, time and data and move in another output file formatted like this way:
31/07/13 23.39.17.75 000000540
28/04/13 22.19.35.22 000008940
As far now i tryied: EDITED
Const ForReading = 1
Const ForWriting = 2
Dim objFSO 'File System Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim objInputTS 'Text Stream Object
Set objInputTS = objFSO.OpenTextFile("D:\Desktop\input.txt", ForReading, False)
Dim objOutputTS 'Text Stream Object
Set objOutputTS = objFSO.OpenTextFile("D:\Desktop\output.txt", ForWriting, True)
Do Until objInputTS.AtEndOfStream
Dim strLine
strLine = objInputTS.ReadLine()
c1 = "* BEGIN DATE"
'WScript.Echo Len(c1)
c2 = "* BEGIN DATE"
'WScript.Echo Len(c2)
c3 = "* DATA INPUT READ"
'WScript.Echo Len(c3)
If (Instr(strLine, 13) = "BEGIN DATE") Then objOutputTS.WriteLine(Mid(strLine, 20))
If (Instr(strLine, 13) = "TIME BEGIN") Then objOutputTS.WriteLine(Mid(strLine, 20))
If (Instr(strLine, 18) = "DATA INPUT READ") Then objOutputTS.WriteLine(Mid(strLine, 22))
Loop
objOutputTS.Close()
objInputTS.Close()
But in my output.txt file nothing appears. I think the problem is * but i don't know. I tryied in all ways. I can't find a way out. What's wrogn in my code?