'=========================[ Start of file ]========================= ' File: LogsToFileBBS.vbs ' Description: FlasGet- ' log- ' Files.bbs ' Installation: TC ' : ":\\\\LogsToFileBBS.vbs" ' : "%P" [! !] ' Version: 3- ' Copyright: (c) 2005, Volniy Option Explicit Dim Fso, LogsCnt Set Fso = CreateObject("Scripting.FileSystemObject") If Fso.FolderExists(WScript.Arguments(0)) = False Then MsgBox " !", vbCritical, "" Else Call EditFilesBBS(Fso.GetFolder(WScript.Arguments(0))) MsgBox " ." & vbCr & _ " LOG- FlashGet: " & LogsCnt, vbInformation, "" End If Set Fso = Nothing WScript.Quit Sub EditFilesBBS(curFolder) Dim F, fExt For Each F In curFolder.Files fExt = UCase(Fso.GetExtensionName(F.Name)) If fExt = "LOG" Then LogsCnt = LogsCnt + 1 ' ' LOG FlashGet- If FilesBBSFromLOG(curFolder.Path, F.Path) Then ' LOG TXT ' F.Name = Fso.GetBaseName(F.Name) & ".txt" ' : ' F.Delete True End If End If Next End Sub Function FilesBBSFromLOG(Path, LogFile) Dim dscNew, tmp, forFile, IsFlashLOG Dim DateTime, URL Dim TS1, TS2, Entry, pos, pos2, TargetION TargetION = Fso.BuildPath(Path, "FILES.BBS") Const ForReading = 1, ForWriting = 2 ' log- Set TS1 = Fso.OpenTextFile(LogFile, ForReading) Do While TS1.AtEndOfStream <> True tmp = TS1.ReadLine 'URL: pos2 = InStr(1, tmp, "URL:", vbTextCompare) If pos2 Then URL = Mid(tmp, pos2 + Len("URL:")) ' URL IsFlashLOG = IsFlashLOG + 1 End If ' : pos2 = InStr(1, tmp, " :", vbTextCompare) If pos2 Then DateTime = Mid(tmp, pos2 + Len(" :")) ' IsFlashLOG = IsFlashLOG + 1 End If ': pos2 = InStr(1, tmp, ":", vbTextCompare) If pos2 Then forFile = Mid(tmp, pos2 + Len(":")) ' IsFlashLOG = IsFlashLOG + 1 End If pos = InStr(1, tmp, ":", vbTextCompare) If pos Then Entry = Mid(tmp, pos + Len(":")) ' Entry IsFlashLOG = IsFlashLOG + 1 ElseIf IsFlashLOG = 4 Then ' 1- - Entry = Entry & vbCrLf & Space(2) & "| " & tmp End If Loop ' : Entry = Entry & vbCrLf & Space(2) & "| " & URL Entry = Entry & vbCrLf & Space(2) & "| " & DateTime TS1.Close Set TS1 = Nothing If Not Fso.FileExists(Fso.BuildPath(Path, forFile)) Then Exit Function If Len(Entry) Then ' ' 8.3 Dim aFile Set aFile = Fso.GetFile(Fso.BuildPath(Path, forFile)) Entry = WIN2DOS(aFile.ShortName & " " & Entry) tmp = "" If Fso.FileExists(TargetION) Then ' FILES.BBS Set TS2 = Fso.OpenTextFile(TargetION, ForReading) tmp = TS2.ReadAll & vbCrLf ' TS2.Close End If dscNew = tmp & Entry On Error Resume Next Set TS2 = Fso.OpenTextFile(TargetION, ForWriting, True) TS2.Write dscNew ' TS2.Close End If Set TS2 = Nothing ' True, FlashGet- LOG FilesBBSFromLOG = CBool(IsFlashLOG = 4) End Function Function WIN2DOS(InputText) Const win = "ߨ" Const dos = "񀁂" Dim tmp, i, pos, char For i = 1 To Len(InputText) char = Mid(InputText, i, 1) pos = InStr(1, win, char) If pos > 0 Then tmp = tmp & Mid(dos, pos, 1) Else tmp = tmp & char End If Next WIN2DOS = tmp End Function '=========================[ End of file ]=========================