Total Commander Forum Index Total Commander
Форум поддержки пользователей Total Commander
Сайты: Все о Total Commander | Totalcmd.net | Ghisler.com | RU.TCKB
 
 RulesRules   SearchSearch   FAQFAQ   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Single Post  Topic: Альтернатива descript.ion 
Author Message
Flasher



PostPosted: Fri Feb 22, 2019 22:18    Post subject: Reply with quote

Code:
extensions=*
Зачем Color для всех типов файлов? Confused

swr wrote:
Отображение в виде 3х колонок:

3, так 3:
Code:
content=Descript
content1=Color
content2=Year

Code:
Set FSO = CreateObject("Scripting.FileSystemObject")
ion = FSO.GetParentFolderName(FileName) & "\descript.ion"

If FSO.FileExists(ion) Then
If FSO.GetFile(ion).Size > 3 Then

' Паттерн замены искомых частей на пробел:
  Pattern  = "(\[[^[\]]+\])+"
' Паттерны искомых частей комментария:
  Pattern1 = "\[[cC]=([^[\]]+)\]"
  Pattern2 = "\[[yY]=([^[\]]+)\]"

  With CreateObject("SAPI.SpFileStream") .Open ion : .Read ArrB, 3 : .Close : End With
  For i = 1 To 2 : Dec = Dec & AscB(MidB(ArrB, i, 1)) : Next
  Select Case Dec
    Case 239187 Enc = "UTF-8"
    Case 255254 Enc = "UTF-16LE"
    Case 254255 Enc = "UTF-16BE"
    Case Else   Enc = "Windows-1251"
  End Select

  With CreateObject("ADODB.Stream")
    .Open : .Type = 2 : .CharSet = Enc : .LoadFromFile ion : All = .ReadText : .Close
  End With

  FileName = FSO.GetFileName(FileName)
  If InStr(FileName, " ") Then FileName = """" & FileName & """"

  Set RExp = New RegExp
  With RExp
    .Pattern = "([[\]\{}\-\(\)^(\$\+\.])" : .Global = 1
    .Pattern = "^" & .Replace(FileName, "\$1") & " ([^\r\n]+)$" : .MultiLine = 1
    If .Test(All) Then
      Comment = .Execute(All)(0).Submatches(0)
     .Pattern = Pattern : Content = Trim(.Replace(Comment, " "))
      Substring Pattern1, Content1
      Substring Pattern2, Content2
    End If
  End With

End If
End If

Set FSO = Nothing : Set RExp = Nothing

Sub Substring(Patt, Cont)
  With RExp
    .Pattern = Patt : If .Test(Comment) Then Cont = .Execute(Comment)(0).SubMatches(0)
  End With
End Sub

_________________
Автору сборки TC Image (Andrey_A) настоятельно рекомендуется не распространять на иных ресурсах любую предоставленную мной где-либо техническую информацию по автоматизации и оптимизации в работе с ТС и системой.
View user's profile Send private message


Powered by phpBB © 2001, 2005 phpBB Group