Functions/Scraping/Format-SendKeys.ps1
Function Format-SendKeys { [CmdletBinding()] Param ( # InputObject [Parameter(Mandatory=$True,ValueFromPipeLine=$true)] [AllowNull()] [AllowEmptyString()] [string] $InputObject, # Powershell send mode will erase whitespace at the beginning of the incoming string to deal with indented text [Parameter(Mandatory=$false)] [Boolean] $TrimStart = $False ) Process { $OutputObject = ($inputobject ` -replace '{','{'` -replace '}','}'` -replace '{','{{}'` -replace '}','{}}'` -replace '\[','{[}'` -replace '\]','{]}'` -replace '\(','{(}'` -replace '\)','{)}'` -replace '\+','{+}'` -replace '\^','{^}'` -replace '\%','{%}'` -replace '\~','{~}'` )` +'{ENTER}' if($TrimStart){$OutputObject = $OutputObject.TrimStart()} $OutputObject } } |