Help with VBscript error, please

Clone / X
January 13, 2018 at 17:35:50
Specs: XP SP3, AMD Ath 64X2 2GB
Help with VBscript error

Here's the error:
line 1 char 48 expected ")"

Here's the VBscript:

Private Function rtftotext(ByVal rtfstring As String) As String
Dim rtf1 As New System.Windows.Forms.RichTextBox
rtf1.Rtf = rtfstring
Return RTFToPlainText(rtf1)
End Function

Private Function RTFToPlainText(ByVal rtfbox As RichTextBox) As String
Dim str As String = String.Empty
For Each line As String In rtfbox.Lines
str += line & vbCrLf
Next
Return str
End Function

=====================

M2 Get custom script or take private lessons


See More: Help with VBscript error, please

Reply ↓  Report •

#1
January 16, 2018 at 03:35:23
I'v ecopied an example double As String statement, which might help you.


Function RegexExtract(ByVal text As String, _
ByVal extract_what As String, _
Optional separator As String = ", ") As String

from:

https://stackoverflow.com/questions...

i5-6600K@4.670GHz/4.448GHz cache@1.33v | 2x4GB Crucial-DDR4-2133@ 15-15-15-31 2T 2817MHz@1.3v | ASUS Z170-K | Samsung 250GB SSD 850 EVO | MSI RX 570 4GB@1384cc&2087mc bios-powertune-mod | Corsair VS45


Reply ↓  Report •

#2
January 20, 2018 at 20:47:25
The script is meant to extract text from rtf files

=====================

M2 Get custom script or take private lessons


Reply ↓  Report •

#3
January 21, 2018 at 22:37:09
Hi m2: I kept working with the system.windows.forms.richtextbox and got nowhere. with 'dim' I got the "expected" error. tried 'createobject' and got 'activex cant create' error (I'm sure I'm doing something wrong). Best I could come up with was:
richtextfile=kri.rtf
set fso=createobject("scripting.filesystemobject")
rtfstring=fso.opentextfile(richtextfile,1).readall
p=split(rtfstring,">")
for c=0 to ubound(p)
'wscript.echo p(c)
k=split(p(c),"<")
for g=0 to ubound(k)
f=left(ltrim(k(g)),1)
' this tries to filter out some other stuff. disabled to be most inclusive
'if f <> "\" then if f <> "/"then wscript.echo k(g)
wscript.echo k(g)
next
next

message edited by nbrane


Reply ↓  Report •

Related Solutions

#4
January 21, 2018 at 23:13:36
Hi nbrane,
As Adrian Cronauer said to the guy in the truck: thank you for playing anyway

=====================

M2 Get custom script or take private lessons


Reply ↓  Report •

Ask Question