Last active
February 4, 2022 14:40
-
-
Save aleksp99/cd1cddccc48a8d1305d5da7958014685 to your computer and use it in GitHub Desktop.
#1С #PowerShell #Обновление1С #Скрипты
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set-Location 'C:\Program Files\1cv8\8.3.18.1520\bin' | |
.\1cv8.exe DESIGNER /S16-113\tmp /DumpConfigToFiles 'D:\xml' -Format Plain |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Clear-Host | |
$keys = '' | |
$xmlFolder = 'D:\xml' | |
$result = 'D:\result.csv' | |
$typesFile = [string[]]('*.html', '*.xsd', '*.Package', '*.xml', '*.txt') | |
$uids = @{} | |
Select-Xml -Path "$($xmlFolder)\ConfigDumpInfo.xml" -XPath '//info:Metadata' -Namespace @{info='http://v8.1c.ru/8.3/xcf/dumpinfo';} | | |
%{$uids.Add($_.Node.Name, $_.Node.id)} | |
Select-String -Path ($xmlFolder + '\*') -Pattern ($keys -join '|') -AllMatches | | |
% { | |
$matchInfo = $_ | |
$file = Get-ItemProperty $matchInfo.Path | |
$matchInfo.Matches | | |
Select-Object ( | |
@{Label='ID'; Expression={$uids[$file.BaseName -replace '\.Form\.Module', '.Form']}}, | |
@{Label='File'; Expression={$file.BaseName}}, | |
@{Label='LineNumber'; Expression={$matchInfo.LineNumber}}, | |
@{Label='Key'; Expression={$_.Value}}, | |
@{Label='Line'; Expression={$matchInfo.Line}} | |
) | |
} | Export-Csv $result -Encoding UTF8 -NoTypeInformation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ТекстовыйДокумент = Новый ТекстовыйДокумент(); | |
ТекстовыйДокумент.Прочитать("D:\result.csv"); | |
ТЗ = Новый ТаблицаЗначений; | |
ТЗ.Колонки.Добавить("Идентификатор", ОбщегоНазначения.ОписаниеТипаСтрока(50)); | |
ТЗ.Колонки.Добавить("ОбъектМД", ОбщегоНазначения.ОписаниеТипаСтрока(1000)); | |
ТЗ.Колонки.Добавить("НомерСтроки", ОбщегоНазначения.ОписаниеТипаЧисло(32, , ДопустимыйЗнак.Неотрицательный)); | |
ТЗ.Колонки.Добавить("Ключ", ОбщегоНазначения.ОписаниеТипаСтрока(150)); | |
ТЗ.Колонки.Добавить("Количество", ОбщегоНазначения.ОписаниеТипаЧисло(32, , ДопустимыйЗнак.Неотрицательный)); | |
ТЗ.Колонки.Добавить("Строка", ОбщегоНазначения.ОписаниеТипаСтрока(0)); | |
RegExp = Новый COMОбъект("VBScript.RegExp"); | |
RegExp.Global = Истина; | |
RegExp.IgnoreCase = Истина; | |
RegExp.Pattern = """([^""]*)"",""([^""]+)"",""(\d+)"",""([^""]+)"",""(.+)""$"; | |
Для Номер = 2 По ТекстовыйДокумент.КоличествоСтрок() Цикл | |
НоваяСтрока = ТЗ.Добавить(); | |
Для Каждого Вхождение Из RegExp.Execute(ТекстовыйДокумент.ПолучитьСтроку(Номер)) Цикл | |
НоваяСтрока.Идентификатор = Вхождение.SubMatches(0); | |
НоваяСтрока.ОбъектМД = Вхождение.SubMatches(1); | |
НоваяСтрока.НомерСтроки = Вхождение.SubMatches(2); | |
НоваяСтрока.Ключ = НРег(Вхождение.SubMatches(3)); | |
НоваяСтрока.Строка = Вхождение.SubMatches(4); | |
НоваяСтрока.Количество = 1; | |
КонецЦикла; | |
КонецЦикла; | |
ТЗ.Свернуть("Идентификатор,ОбъектМД,Ключ", "Количество"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment