'••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
' Создать текстовые инфо-файлы к выбранным
' Параметры: %WL "<папка сохранения>" <открывать файлы: 1>
' Пример: %WL "%T" 1
' Автор - Flasher ©
'••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
With WScript.Arguments
C = .Count : If C = 0 Then WScript.Quit
Set FSO = CreateObject("Scripting.FileSystemObject")
Set List = FSO.OpenTextFile(.Item(0),,,-1)
Path = FSO.BuildPath(.Item(1), "\") : If C = 3 Then Open = .Item(2)
End With : Set ShA = CreateObject("Shell.Application")
Set Dict = CreateObject("Scripting.Dictionary")
Do Until List.AtEndOfStream
F = List.ReadLine
If F <> "" And FSO.FileExists(F) And LCase(FSO.GetExtensionName(F)) <> "txt" Then
With FSO.GetFile(F)
Set Folder = ShA.NameSpace(.ParentFolder.Path)
All = "" : Set File = Folder.ParseName(.Name)
End With : Dict.RemoveAll : Max = 0
For i = 0 to 288
If i <> 155 And i <> 176 And i <> 178 And i <> 180 And i <> 182 Then
Value = Folder.GetDetailsOf(File, i)
If Value <> "" And InStr(LCase(Value), " нет") = 0 And InStr(Value, "Нет") = 0 And _
InStr(LCase(Value), "отсутствует") = 0 And InStr(LCase(Value), "без ") = 0 Then
Name = Folder.GetDetailsOf(0, i) : Ln = Len(Name) : If Ln > Max Then Max = Ln
Dict.Add Name, Value
End If
End If
Next
For Each Key in Dict.Keys
All = All & vbNewLine & Key & ": " & String(Max - Len(Key), " ") & Dict.Item(Key)
Next : NF = Path & FSO.GetBaseName(F) & ".txt" : If Not FSO.FileExists(NF) Then _
FSO.OpenTextFile(NF, 2, True, -1).Write Mid(All, 3) : If Open = 1 Then ShA.Open(NF)
End If
Loop |