I need help with my script.
It works by dragging and dropping a file on to the vbs script.
When it does it need to search through the text file dropped on it and find the first char of every line.
If the first char is a 0 then replace 0 with double space.
If the first char is a 1 then replace with a page break.
I only have it searching for the 0 at the beginning of the file currently.
It always errors out when trying to find the file that was dropped on to it.
Any help is appreciated.
Here is the script:
dim myfile
Set fso = CreateObject("Scripting.FileSystemObject")
Set regEx = New RegExp
regEx.Pattern = "^(0)"
regEx.Global = True
myfile = fso.GetFile(WScript.Arguments(0))
myfile = chr(34) & myfile & chr(34)
Do While Not EOF
txtFile = regEx.Replace(fspenTextFile(WScript.Arguments(0)).ReadAll, " ")
fspenTextFile(WScript.Arguments(0), 2, True).Write txtFile
loop
fso.close
It works by dragging and dropping a file on to the vbs script.
When it does it need to search through the text file dropped on it and find the first char of every line.
If the first char is a 0 then replace 0 with double space.
If the first char is a 1 then replace with a page break.
I only have it searching for the 0 at the beginning of the file currently.
It always errors out when trying to find the file that was dropped on to it.
Any help is appreciated.
Here is the script:
dim myfile
Set fso = CreateObject("Scripting.FileSystemObject")
Set regEx = New RegExp
regEx.Pattern = "^(0)"
regEx.Global = True
myfile = fso.GetFile(WScript.Arguments(0))
myfile = chr(34) & myfile & chr(34)
Do While Not EOF
txtFile = regEx.Replace(fspenTextFile(WScript.Arguments(0)).ReadAll, " ")
fspenTextFile(WScript.Arguments(0), 2, True).Write txtFile
loop
fso.close