Mit diesem Skript kann man diese komplett entfernen, damit man sich beim Mergen auf das wesentliche konzentieren kann .
FĂĽr die Umarbeitung zur Stapelverarbeitung die Variable $inputfile durch $args austauschen und den Code fĂĽr das Fenster entfernen und die Funktion zusammen mit dem Dateipfad aufrufen.
- Code: Alles auswählen
function RemoveToolTipsDlg
{
$ErrorActionPreference = "Stop"
$PSDefaultParameterValues['*:ErrorAction']='Stop'
Function Get-FileName($initialDirectory)
{
[System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") | Out-Null
$OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
$OpenFileDialog.initialDirectory = $initialDirectory
$OpenFileDialog.filter = "NAV Object Files (*.txt)|*.txt"
$OpenFileDialog.ShowDialog() | Out-Null
$OpenFileDialog.filename
}
$inputfile = Get-FileName "C:\TEMP" # This is the default path in OpenFile window. Alternative: $env:TEMP
if ($inputfile -eq "") {throw 'Please select a file'}
$ToggleExportOn = $true
$ToggleExportOff = $false
$OldValueToggleExportOff = $false
$inputfile = resolve-path $inputfile
$WorkingFolder = Split-Path -Parent $inputfile
$convertedFileName = [System.IO.Path]::GetFileNameWithoutExtension($inputfile) +"_NTT" + [System.IO.Path]::GetExtension($inputfile)
$convertedfile = New-Item -path "$WorkingFolder\$convertedFileName" -type file -force
IF (Test-Path $ConvertedFile) {Remove-Item $ConvertedFile}
IF (Test-Path "$inputfile.tmp") {Remove-Item "$inputfile.tmp"}
$sr = new-object System.IO.StreamReader($inputfile,[system.text.encoding]::GetEncoding(850))
$sw = new-object System.IO.Streamwriter("$inputfile.tmp",$false,[system.text.encoding]::GetEncoding(850))
while (-not $sr.EndOfStream)
{
$Currline = $Sr.ReadLine()
$TrimmedCurrline = $Currline.TrimStart()
if ($TrimmedCurrline.StartsWith('ToolTipML=['))
{
$ToolTipSection = $true
$EndofToolTipSection = $false
$OldValueToolTipSection = $true
}
if ($OldValueToolTipSection)
{if ($Currline.endswith('];'))
{
$EndofToolTipSection = $true
$OldValueToolTipSection = $false
}
}
if ((-not $ToolTipSection) -and (-not $TrimmedCurrline.StartsWith('ToolTipML=')))
{$sw.writeline($Currline)}
if ($EndofToolTipSection)
{
$OldValueToolTipSection = $False
$ToolTipSection = $False
}
}
$sr.Close()
$sr.Dispose()
$sw.close()
$sw.Dispose()
Rename-Item -path "$inputfile.tmp" -NewName $convertedFileName -force -verbose
}
remove tooltips tool tips