『第
5 楼』:
我以前的vbs
'''设置每篇字数
oLth=3500'''vb字
set fso=createobject("scripting.filesystemobject")
flpth=inputbox("the file to be splited","split joint.txt","joint.txt")
set fl=fso.opentextfile(flpth)
ctnt=fl.ReadAll
dl=MsgBox("是否符合段前空两格而优化",vbokcancel)
If dl=1 then
ctnt=Replace(ctnt,vbcrlf&" ",vbcrlf&"ㄓ")
ctnt=Replace(ctnt,vbcrlf&" ",vbcrlf&"ㄓ")
ctnt=Replace(ctnt," ","")
ctnt=Replace(ctnt," ","")
ctnt=Replace(ctnt,"ㄓ",vbcrlf&" ")
for i=1 to 5
ctnt=Replace(ctnt,vbcrlf&vbcrlf&vbcrlf&vbcrlf,vbcrlf)'''n-1=i times
ctnt=Replace(ctnt,vbcrlf&vbcrlf,vbcrlf)
next
End if
fl.Close
Tlth=Len(ctnt)
If Tlth<oLth Then
MsgBox("已达要求")
else
newn=fso.GetBaseName(flpth)
extn=fso.GetExtensionName(flpth)
Tct=Tlth\oLth+1
n=0
Do
n=n+1
If Tct>=10^(n-1) And Tct<10^n Then Bct=n:Exit Do
Loop
Set fl=fso.GetFile(flpth)
Set bfdr=fso.GetFolder(fl.ParentFolder)
If fso.FolderExists(bfdr&"\"&newn)=true Then
Set fdr=fso.getFolder(bfdr&"\"&newn)
else
Set fdr=fso.CreateFolder(bfdr&"\"&newn)
End If
For i=1 To Tct
strt=oLth*(i-1)+1
ct=String(n-Len(i),"0")&i
Set fl=fdr.CreateTextFile(ct&"."&extn)
newf=Mid(ctnt,strt,oLth)
fl.write newf
fl.close
Next
End If
MsgBox("Done.分了"&Tct&"个文件.")
|