『第
16 楼』:
dim fso, f1, f2, regex, arr
dim str, num1, num2, num3, fn1, fn2
fn1=inputbox("请输入提取文件名","信息","1.loc")
fn2=inputbox("请输入生成文件名","信息","1.csv")
set regex=new regexp
regex.pattern="^"&inputbox("请输入包含字符的行","信息","ELCD")
regex.ignorecase=true
set fso=createobject("scripting.filesystemobject")
set f2=fso.createtextfile(fn2,true)
f2.writeline "Log"&","&"Distance"&","&"4Hz"&","&"4Hz"&","&"Depth"
f2.writeline "#"&","&"(m)"&","&"(mA)"&","&"(dBmA)"&","&"(cm)"
set f1=fso.opentextfile(fn1,1)
do while f1.atendofstream<>true
str=f1.readline
if regex.test(str) then
arr=split(str,",")
if arr(4)>0 then
num1=arr(4)*1000
num2=log(num1)/log(10)*20
num3=arr(2)*100
f2.writeline arr(1)&","&","&num1&","&round(num2,2)&","&num3&","
end if
end if
loop
f2.close
f1.close
msgbox "OK"
set f1=nothing
set f2=nothing
set regex=nothing
set fso=nothing
|