Last active
November 25, 2024 15:49
-
-
Save eugrus/d92417a6e256b244e9c7adde0817d63f to your computer and use it in GitHub Desktop.
Rubrum eines anwaltlichen Schreibens auslesen
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
function Rubrumauslese () { | |
$wordApp = [Runtime.Interopservices.Marshal]::GetActiveObject('Word.Application') | |
$doc = $wordApp.ActiveDocument | |
$documentText = $doc.Content.Text -replace '\r',[System.Environment]::Newline | |
$Az = [regex]::match($documentText, '\d{1,5}/\d{2}').Value | |
$Mandant, $Gegner = ((Select-String -InputObject $documentText -Pattern '.*\./\..*').matches.value -split './.').trim() | |
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($wordApp) | Out-Null | |
return [PSCustomObject]@{ | |
Mandant = $Mandant | |
Gegner = $Gegner | |
Az = $Az | |
} | |
} | |
$Rubrum = Rubrumauslese | |
$Az = $Rubrum.Az | |
$Mandant = $Rubrum.Mandant | |
$Gegner = $Rubrum.Gegner | |
Write-Output "$Mandant" | |
Write-Output "./." | |
Write-Output "$Gegner" | |
Write-Output "$Az" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment