自己写的一个整理数据的vbs 大神们帮我看看,哪里有错误
const forreading=1,forwriting=2,tristateusedeafult=-2
dim fsoA,fA,tA,fsoB,fB,tB,str,dir,str1,A
tihuan
delspa
sub delspa
dir="a.txt"
set fsoA=CreateObject("scripting.filesystemobject")
set fA=fsoA.getfile(dir)
set tA=fA.openastextstream(forreading,tristateusedeafult)
set fsoB=CreateObject("scripting.filesystemobject")
fsoB.createtextfile("OK"+dir)
set fB=fsob.getfile("OK"+dir)
set tB=fB.openastextstream(forwriting,tristateusedeafult)
while not tA.atendofstream
str=tA.readline
str1=split(str,"")
if trim(str)<>"" then tB.writeline str
if instr(str1(0),"@")>0 then tB.writeline str
if instr(str1(1),"@")>0 then A=str1(1) str(1)=str(0) str1(0)=A tB.writeline str
wend
tB.close
tA.close
MsgBox "处理完毕"
end sub
sub tihuan
x = "="
y = ","
z = " "
Set fso = CreateObject("Scripting.FileSystemObject")
n = "a.txt"
words = fso.OpenTextFile(n,1,1).ReadAll
fso.OpenTextFile(n,2,1).Write Replace(words,x,"")
words = fso.OpenTextFile(n,1,1).ReadAll
fso.OpenTextFile(n,2,1).Write Replace(words,y,"")
words = fso.OpenTextFile(n,1,1).ReadAll
fso.OpenTextFile(n,2,1).Write Replace(words,z,"")
end sub
自己写的一个整理数据的vbs
大神们帮我看看,哪里有错误,提示我是语句未结束啊。。
[解决办法]
加冒号,不过建议这种都用块的方式,不要都放在一行。
if instr(str1(1),"@")>0 then A=str1(1) :str(1)=str(0) :str1(0)=A :tB.writeline str