' SortSectionINI.vbs '======================== Описание ===================================== ' Сортировка секций INI файла в алфавитном порядке '======================= Параметры ====================================== ' 1-й параметр: ' 1 - сортировать выделенные секции, если ничего не выделено, то сортируется все секции ' File - полный путь к INI файлу в котором необходима сортировка секций '======================== Примеры ====================================== ' -"Сортировать выделенные секции активного INI файла" Call("Scripts::Main", 1, "SortSectionINI.vbs", `"1"`) ' -"Сортировать секции C:\Test.ini" Call("Scripts::Main", 1, "SortSectionINI.vbs", `"C:\Test.ini"`) ' используется Functions.vbs, который следует положить в ...AkelFiles\Plugs\Scripts\Include\ ' Автор: Аверин Андрей ' Версия: 1.0 (26.01.2016) ' Mail: Averin-And@yandex.ru ' Site: http://tc-image.3dn.ru/forum/9-1010-14558-16-1453766841 '=========================================================================== With WScript Cnt = .Arguments.Count If Cnt = 0 Then .Quit P = .Arguments(0) End With With AkelPad .Include("Functions.vbs") : K = 1 : S = 0 Select Case P Case "1" SetRedraw .GetEditWnd, False Text = .GetSelText(3) If Len(Text) = 0 Then Text = .GetTextRange(0, -1, 3) S = 1 End If If Len(Text) = 0 Then EndRedraw Case Else File = GetPath(P) If Not FFExists(File, 1) Then Wscript.Quit aFile = ReadInfoFile(File,4) If aFile(0) = -4 Then Wscript.Quit Text = aFile(3) K = 0 End Select aSection = GetInfoINI(Text, 7, "") If Not IsArray(aSection) Then EndRedraw aTS = GetInfoINI(Text, 23, aSection) SortingUpTwoArray aSection, 0, Ubound(aSection), aTS Text = DelLastEmptyLine(TextFormat(vb & Join(aTS, vb), 19)) If K = 1 Then If S = 1 Then .SetSel 0, -1 .ReplaceSel(Text) : SaveEditFile : EndRedraw Else .WriteFile File, Text, -1, aFile(1), aFile(2), 1 End If End With |