Jochen
KiX Supporter
   
Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
|
Very messy !!!
Roflmao ...
Full story so far (without Wordfile.ini so you might want to comment the lines at the beginning from if exist($Wordfile) to its endif !)
code:
;PostPrep 1.0
; KIXTART 4.12 (WKiX32) ; KIXFORMS build 37 ; AUTHOR Jochen Polster
break on
$ReqFormsBuild = 36 $Version = "1.0" $Wordfile = @scriptdir + '\Wordfile.ini' $Kix = substr(@kix,1,4)
Global $SourceText[0],$Colors[6] $Sections = "Comments","Strings","Numbers","Commands","Functions","Macros","Operators"
;if exist($Wordfile) ; for $i = 0 to 6 ; $Colors[$i] = readprofilestring($Wordfile,$Sections[$i],"Color") ; next ; $Commands = split(readprofilestring($Wordfile,"Commands", "words"),',') ; $Functions = split(readprofilestring($Wordfile,"Functions","words"),',') ; $Macros = split(readprofilestring($Wordfile,"Macros", "words"),',') ; $Operators = split(readprofilestring($Wordfile,"Operators","words"),',') ; if not ubound($commands) ; or not ubound($functions) ; or not ubound($macros) ; or not ubound($Operators) ; or not ubound($Colors) ; $ = messagebox('This Script requires a wordfile ','Unexpected Error',4112) ; quit() ; endif ;else ; $ = messagebox('This Script requires a wordfile ','Unexpected Error',4112) ; quit() ;endif
$frm = createobject("Kixtart.Form")
if val($frm.Build) < $ReqFormsBuild $ = messagebox('This Script requires Kixforms build ' + $ReqFormsBuild,'Version check',4112) quit() endif
$frm.Size = 640,500 $frm.Caption = "UBB Postprep " + $Version $frm.Icon = "SHELL32.dll;2" $frm.Center
$lblPowered = $frm.Label("Powered by", $frm.ClientWidth-90,$frm.ClientHeight-100,90,20) $lblPowered.FontName = "Comic sans MS" $lblPowered.FontBold = 1 $lblPowered.FontSize = 10 $lblPowered.ForeColor = Kixtart
$lblBuild = $frm.Label("KiXtart " + $kix + @crlf + "and KiXforms" + @crlf + " build " + $frm.Build, $frm.ClientWidth-90,$frm.ClientHeight-80,90,60) $lblBuild.FontName = "Comic sans MS" $lblBuild.FontBold = 1 $lblBuild.FontSize = 7 $lblBuild.ForeColor = Kixtart
$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
$txtTarget = $frm.TextBox $txtTarget.Left = 5 $txtTarget.Top = 5 + $txtSource.Bottom $txtTarget.Right = $frm.ClientWidth - 100 $txtTarget.Bottom = $frm.ClientHeight - 20 $txtTarget.ScrollBars = 3 $txtTarget.FontName = "Courier New" $txtTarget.FontSize = 8 $txtTarget.MultiLine = 1
$lblStatus1 = $frm.Label("",5,$frm.ClientHeight-17,$frm.ClientWidth/3*2,15) $lblStatus1.BorderStyle = 5
$lblStatus2 = $frm.Label("",$lblStatus1.Right+3,$frm.ClientHeight-17,$frm.ClientWidth/3-10,15) $lblStatus2.BorderStyle = 5
$prg = $lblStatus2.ProgressBar $prg.Size = $frm.ClientWidth/3-10,13 $prg.Style = 1 $prg.BorderStyle = 0 $prg.Value = 0
$btnOpen = $frm.Button $btnOpen.Caption = "Open..." $btnOpen.Left = $txtTarget.Right + 10 $btnOpen.Top = 5 $btnOpen.Width = 80 $btnOpen.Height = 25 $btnOpen.BorderStyle = 5 $btnOpen.OnClick = "btnOpen_Click()"
$btnColor = $frm.Button $btnColor.Caption = "Set Colors..." $btnColor.Left = $txtTarget.Right + 10 $btnColor.Top = $btnOpen.Bottom + 2 $btnColor.Width = 80 $btnColor.Height = 25 $btnColor.BorderStyle = 5 $btnColor.OnClick = "btnColor_Click()"
$btnConvert = $frm.Button $btnConvert.Caption = "Convert" $btnConvert.Left = $txtTarget.Right + 10 $btnConvert.Top = $btnColor.Bottom + 2 $btnConvert.Width = 80 $btnConvert.Height = 25 $btnConvert.BorderStyle = 5 $btnConvert.OnClick = "btnConvert_Click()"
$frm.Show while $frm.Visible $ = execute($frm.DoEvents) loop
function btnOpen_Click() dim $FileName, $nl $FileName = $frm.FileOpenDialog("Open File ...", "", "", "KiX Files|*.kix;*.udf;*.k2k|All Files|*.*", 1) if $FileName $ = open(1,$Filename,2) if not @error dim $count $txtSource.Text = "" redim $SourceText[0] $count = 1 $frm.MousePointer = 11 $txtSource.BeginUpdate $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) $txtSource.EndUpdate $frm.MousePointer = 0 endif endif endfunction
function btnColor_Click() dim $frmDialog1, $cR, $cG, $cB, $c, $steps
$frmDialog1 = createobject("Kixtart.Form") $frmDialog1.Size = 300,254 $frmDialog1.Caption = "Set Colors"
$cboStrings = $frmDialog1.ComboBox $cboStrings.List = "Comments","Strings","Numbers","Commands","Functions","Macros","Operators" $cboStrings.Location = 5,5 $cboStrings.ListIndex = 0
$chkBold = $frmDialog1.CheckBox("Bold",5,30,50,15)
$picChoice = $frmDialog1.PictureBox("",8,60,279,160) $picChoice.DrawWidth = 2 ;pixels $picChoice.FillStyle = 1 ; solid $picChoice.BorderStyle = 0
$cR = &00 $cG = &00 $cB = &00 $c = $cR + $cG + $cB $Steps = 84
for $i = 4 to $picChoice.ClientHeight step 23 for $j = 4 to $picChoice.ClientWidth step 23 $picChoice.ForeColor = $c $picChoice.FillColor = $c $picChoice.Rectangle($j,$i,19,19) select case $i + $j < $steps / 3 $cR = $cR + ( 255 / 84 ) case $i + $j > $steps / 3 $cG = $cG + ( 255 / 84 ) case $i + $j > $steps / 3 * 2 $cB = $cB + ( 255 / 84 ) endselect $c = $cR + $cG + $cB next next
$frmDialog1.Show while $frmDialog1.Visible $ = execute($frmDialog1.DoEvents) loop endfunction
function btnConvert_Click() $txtTarget.BeginUpdate
$txtTarget.EndUpdate endfunction
[ 05. December 2002, 13:20: Message edited by: jpols ]
_________________________
|