sub showORG() '在文本框内加载文件 dim f,ts,s if fso.FileExists(fileORG.value) then set f = fso.GetFile(fileORG.value) set ts = f.OpenAsTextStream(1) s="" if not ts.AtEndOfStream then s = ts.ReadAll end if ts.Close blockORG.value = s end if end sub
Function LastOne(Str,splitStr) '输入字符和分隔符,得到最后一部分 LastOne = right(Str,len(Str)-InStrRev(Str,splitStr)) End Function
function getFolderDir(fullDir) '输入得到全路径,得到文件夹路径 s=LastOne(fullDir,"/") getFolderDir = left(fullDir,len(fullDir)-len(s)) end function
function px2Int(px) px2Int = cint(replace(px,"px","")) end function
sub gogogo() Re.IgnoreCase = Imode.checked Re.Global = Gmode.checked Re.Pattern = blockReg.value replaceStr = replaceVar.value select case window.event.srcElement.id case "isVBS" replaceStr = eval(replaceStr) case "isJS" window.execScript "jsvalue.value=eval(replaceVar.value);","javaScript" replaceStr = jsvalue.value end select showMe.value = Re.Replace(blockORG.value,replaceStr) end sub
sub back showMe.value = "" end sub
sub saveFile if fso.FileExists(fileORG.value) then set f = fso.GetFile(fileORG.value) f.copy fileORG.value & makeRand() & ".bak"'创建备份 set ts = f.OpenAsTextStream(2) ts.write showMe.value ts.Close blockORG.value = showMe.value else set ts = fso.OpenTextFile(thisFileFolder & makeRand() & ".txt",2,true) ts.write showMe.value ts.Close blockORG.value = showMe.value end if end sub
function makeRand() dim resault resault = mid(cstr(now()),3) resault =replace(resault,":","") resault =replace(resault,"-","") resault =replace(resault," ","") makeRand = resault end function