Break On
Dim $Ret, $System, $TestForm, $cmd
$Ret = SetOption("explicit", "on")
$TestForm = CreateObject("Kixtart.Form")
If @ERROR
$cmd = 'msiexec /i "' + @SCRIPTDIR + '\KiXforms.msi" /qb /norestart'
Shell $Cmd
EndIf
$System = CreateObject("KiXtart.System")
Dim $Form1
$Form1 = $System.Form()
$Form1.Text = "Test"
Dim $RichTextBox1
$RichTextBox1 = $Form1.Controls.RichTextBox()
$RichTextBox1.Location = 13, 13
$RichTextBox1.Size = 259, 195
Dim $Button1
$Button1 = $Form1.Controls.Button()
$Button1.Text = "Done"
$Button1.Size = 75, 23
$Button1.Location = 96, 227
$Button1.OnClick = "onDone($$Form1, $$RichTextBox1)"
$RichTextBox1.html = "This is an example test. <Br><Br><Br>Text you add here is not shown via .html, but via .text, try it!<p> An example of <b>BoldText</b></p>"
Dim $Null
$Form1.Show
While $Form1.Visible
$Null=Execute($System.Application.DoEvents)
Loop
Function onDone($Form1,$RichTextBox)
Dim $html,$nul
$html = RTFBoxHTML($RichTextBox)
$nul = MessageBox($html,"HTML",0)
$Form1.visible = 0
EndFunction
Function RTFBoxHTML($RichTextBox)
Dim $rtffile,$htmlfile,$nul,$word,$doc,$fso
$rtffile = "%temp%\"+@Ticks+".rtf"
$htmlfile = "%temp%\"+@Ticks+".html"
$nul = Execute('$$RichTextBox.SaveFile($$rtffile)')
$word = CreateObject("Word.Application")
$doc = $word.Documents.Open($rtffile)
$doc = $word.ActiveDocument()
$doc.SaveAs($htmlfile, 10)
$doc.Close()
$word.Quit()
$fso = CreateObject("Scripting.FileSystemObject").GetFile($htmlfile)
$RTFBoxHTML = $fso.OpenAsTextStream(1,-2).Read($fso.size)
Del $rtffile
del $htmlfile
EndFunction