Hi all,
Here is my actual project (by now it just opens any Textfile in the first TextBox)
code:
;PostPrep 1.0
; KIXTART 4.12 (WKiX32)
; KIXFORMS build 37
; AUTHOR Jochen Polster
break on
$ReqFormsBuild = 36
$Version = "1.0"
Global $SourceText[0]
$frm = createobject("Kixtart.Form")
if val($frm.Build) < $ReqFormsBuild
$ = messagebox('This Script requires Kixforms build ' + $ReqFormsBuild,'Version check',4112)
Quit()
endif
$frm.Size = 640,480
$frm.Caption = "UBB Postprep " + $Version
$frm.Icon = "SHELL32.dll;2"
$frm.Center
$txtSource = $frm.TextBox
$txtSource.Left = 5
$txtSource.Top = 5
$txtSource.Right = $frm.ClientWidth - 100
$txtSource.Bottom = $frm.ClientHeight / 2 - 3
$txtSource.ScrollBars = 3
$txtSource.FontName = "Courier New"
$txtSource.FontSize = 8
$txtSource.MultiLine = 1
$rtfTarget = $frm.RichTextBox
$rtfTarget.Left = 5
$rtfTarget.Top = 5 + $txtSource.Bottom
$rtfTarget.Right = $frm.ClientWidth - 100
$rtfTarget.Bottom = $frm.ClientHeight - 5
$btnOpen = $frm.Button
$btnOpen.Caption = "Open..."
$btnOpen.Left = $rtfTarget.Right + 10
$btnOpen.Top = 5
$btnOpen.Width = 80
$btnOpen.Height = 25
$btnOpen.OnClick = "btnOpen_Click()"
$frm.Show
while $frm.Visible
$ = execute($frm.DoEvents)
loop
function btnOpen_Click()
dim $FileName, $nl
$FileName = $frm.FileOpenDialog("Open", "", "", "", 0)
if $FileName
$ = open(1,$Filename,2)
if not @error
$frm.BeginUpdate
redim $SourceText[0]
$SourceText[0] = readline(1)
$txtSource.Text = "" + $SourceText[0]
while @error = 0
redim preserve $SourceText[ubound($SourceText)+1]
$SourceText[ubound($SourceText)] = $nl
$txtSource.Text = $txtSource.Text + @crlf + $SourceText[ubound($SourceText)]
$nl = readline(1)
loop
$ = close(1)
$frm.EndUpdate
endif
endif
endfunction
To be implemented :
-> Convert to html 'code' with preferred colors for Keywords
-> Custom color choosable for different groups of words
Issues by now :
-> it adds an aditional crlf after the first line
J.
[ 06. December 2002, 11:41: Message edited by: jpols ]