Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
[blue][COLOR=green]# cleanrichtext.ps1
# Author: Mike Strong
# Datew: 5 Dec 2019
# Simple example of converting RTF to plain text for tek-tips[/color]
param (
[COLOR=green]# default rtf if argument not passed[/color]
[string]$in = "{\rtf1\ansi\ansicpg1252\deff0\deflang1040{\fonttbl{\f0\fnil\fcharset0 Arial;}}\viewkind4\uc1\pard\fs20 example only\par }"
)
Add-Type -AssemblyName System.Windows.forms [COLOR=green]# make sure assembly is available[/color]
$rtfBox = New-Object System.Windows.Forms.RichTextBox
try [COLOR=green]# see if we can parse the rtf successfully[/color]
{
$rtfBox.rtf=($in)
}
catch
{
$rtfBox.text="Source is badly formed rich text" [COLOR=green]# oops, not good RTF[/color]
}
Write-Output $rtfBox.Text[/blue]
[blue][COLOR=green]' Author: Mike Strong
' 05 Dec 2019
' Example for converting RTF into plain text using powershell from VBScript[/color]
pscommand = "d:\downloads\ps_scripts\cleanrichtext.ps1" [COLOR=green]' the powershell script[/color]
rtf="'{\rtf1\ansi\ansicpg1252\deff0\deflang1040{\fonttbl{\f0\fnil\fcharset0 Arial;}}\viewkind4\uc1\pard\fs20 test to clean words\par }'"
cmd = "powershell " & pscommand & " -in " & rtf [COLOR=green]' Warning: maximum commandline length 8190 characters[/color]
Set shell = CreateObject("WScript.Shell")
Set exec = shell.Exec(cmd)
exec.StdIn.Close
strPlainText=exec.StdOut.ReadAll
MsgBox strPlainText[/blue]
[blue]rtf="[COLOR=red][b]'[/b][/color]{\rtf1\ansi\ansicpg1252\deff0\deflang1040{\fonttbl{\f0\fnil\fcharset0 Arial;}}\viewkind4\uc1\pard\fs20 test to clean words\par }[COLOR=red][b]'[/b][/color]"[/blue]
[blue]rtf = "'" & ObjAdoDbRecordSet_10("DESCRESTESA") & "'"[/blue]