For Example:
Hello World! to Ascii codes Returns
Code: Select all
72 101 108 108 111 32 87 111 114 108 100 33
Code: Select all
H:e:l:l:o: :W:o:r:l:d:!:
Code: Select all
Dialog>Dialog1
object Dialog1: TForm
Left = 247
Top = 96
HelpContext = 5000
BorderIcons = [biSystemMenu]
Caption = 'Convert Text to Ascii or HTML Code'
ClientHeight = 340
ClientWidth = 287
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = True
ShowHint = True
OnTaskBar = False
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 8
Top = 8
Width = 72
Height = 13
Caption = 'Text to convert'
end
object Label2: TLabel
Left = 8
Top = 128
Width = 32
Height = 13
Caption = 'Output'
end
object Label3: TLabel
Left = 8
Top = 108
Width = 60
Height = 13
Caption = '0 Characters'
end
object Label4: TLabel
Left = 8
Top = 296
Width = 3
Height = 13
end
object MSMemo1: tMSMemo
Left = 8
Top = 24
Width = 273
Height = 81
ScrollBars = ssVertical
TabOrder = 0
end
object MSMemo2: tMSMemo
Left = 8
Top = 144
Width = 273
Height = 121
ScrollBars = ssVertical
TabOrder = 1
end
object MSButton1: tMSButton
Left = 128
Top = 312
Width = 75
Height = 25
Caption = 'Convert'
TabOrder = 2
DoBrowse = False
BrowseStyle = fbOpen
end
object MSButton2: tMSButton
Left = 208
Top = 312
Width = 75
Height = 25
Caption = 'Copy'
TabOrder = 3
DoBrowse = False
BrowseStyle = fbOpen
end
object CheckBox1: TCheckBox
Left = 8
Top = 316
Width = 105
Height = 17
Caption = 'Convert to HTML'
TabOrder = 4
end
object ProgressBar1: TProgressBar
Left = 8
Top = 272
Width = 273
Height = 17
TabOrder = 5
end
object MSButton3: tMSButton
Left = 208
Top = 112
Width = 75
Height = 25
Caption = 'Paste'
TabOrder = 6
DoBrowse = False
BrowseStyle = fbOpen
end
object MSButton4: tMSButton
Left = 128
Top = 312
Width = 75
Height = 25
Caption = 'Stop'
TabOrder = 15
Visible = False
DoBrowse = False
BrowseStyle = fbOpen
end
end
EndDialog>Dialog1
AddDialogHandler>Dialog1,MSMemo1,OnChange,GetLength
AddDialogHandler>Dialog1,msButton1,OnClick,Convert
AddDialogHandler>Dialog1,MSButton2,OnClick,Copy
AddDialogHandler>Dialog1,MSButton3,OnClick,Paste
AddDialogHandler>Dialog1,MSButton4,OnClick,Stop
AddDialogHandler>Dialog1,,OnClose,Exit
Let>StopFlag=0
Show>Dialog1
Label>Loop
Wait>1
Goto>Loop
SRT>Convert
SetDialogProperty>Dialog1,msButton1,Visible,False
SetDialogProperty>Dialog1,msButton1,Enabled,False
SetDialogProperty>Dialog1,msButton2,Enabled,False
SetDialogProperty>Dialog1,msButton3,Enabled,False
SetDialogProperty>Dialog1,msButton4,Visible,True
SetDialogProperty>Dialog1,CheckBox1,Enabled,False
SetDialogProperty>Dialog1,MSMemo2,Text,
Let>TextToConvert=WhED55oIO
GetDialogProperty>Dialog1,MSMemo1,Text,TextToConvert
Length>%TextToConvert%,InputLeng
SetDialogProperty>Dialog1,ProgressBar1,Max,%InputLeng%
SetDialogProperty>Dialog1,ProgressBar1,Position,0
IF>InputLeng>0
Let>CharCounter=0
Let>OutputMsg=
Repeat>CharCounter
Add>CharCounter,1
SetDialogProperty>Dialog1,ProgressBar1,Position,%CharCounter%
MidStr>%TextToConvert%,%CharCounter%,1,Char
StringReplace>%Char%,CR,CarriageReturn,crRes
StringReplace>%Char%,%LF%,LineFeed,lfRes
IF>{(%crRes%="CarriageReturn")OR(%lfRes%="LineFeed")}
GetDialogProperty>Dialog1,CheckBox1,Checked,HTMLChecked
IF>HTMLChecked=True
IF>%crRes%=CarriageReturn
Let>OutputMsg=%OutputMsg%<br>
ENDIF
ELSE
Let>AsciiValue=13
Let>OutputMsg=%OutputMsg%%SPACE%%AsciiValue%
ENDIF
ELSE
GetDialogProperty>Dialog1,CheckBox1,Checked,HTMLChecked
IF>HTMLChecked=True
IF>Char="
Let>AsciiValue=34
Let>OutputMsg=%OutputMsg%&#%AsciiValue%;
ELSE
Let>TheChar="%Char%"
VBEval>Asc(%TheChar%),AsciiValue
Let>OutputMsg=%OutputMsg%&#%AsciiValue%;
ENDIF
ELSE
IF>Char="
Let>AsciiValue=34
Let>OutputMsg=%OutputMsg%%SPACE%%AsciiValue%
ELSE
Let>TheChar="%Char%"
VBEval>Asc(%TheChar%),AsciiValue
Let>OutputMsg=%OutputMsg%%SPACE%%AsciiValue%
ENDIF
ENDIF
ENDIF
Let>CharRemaining=%InputLengA%-%CharCounter%
SetDialogProperty>Dialog1,Label4,Caption,%CharRemaining% Characters remaining
IF>StopFlag=1
Let>CharCounter=%InputLeng%
ENDIF
Until>CharCounter,%InputLeng%
SetDialogProperty>Dialog1,Label4,Caption,
SetDialogProperty>Dialog1,MSMemo2,Text,%OutputMsg%
ELSE
SetDialogProperty>Dialog1,MSMemo2,Text,
ENDIF
Let>StopFlag=0
SetDialogProperty>Dialog1,Label4,Caption,
SetDialogProperty>Dialog1,msButton1,Visible,True
SetDialogProperty>Dialog1,msButton1,Enabled,True
SetDialogProperty>Dialog1,msButton2,Enabled,True
SetDialogProperty>Dialog1,msButton3,Enabled,True
SetDialogProperty>Dialog1,CheckBox1,Enabled,True
SetDialogProperty>Dialog1,msButton4,Visible,False
END>Convert
SRT>Copy
GetDialogProperty>Dialog1,MSMemo2,Text,OutputCode
PutClipBoard>%OutputCode%
END>Copy
SRT>Paste
GetClipBoard>TheClipBoard
SetDialogProperty>Dialog1,MSMemo1,Text,%TheClipBoard%
END>Paste
SRT>GetLength
GetDialogProperty>Dialog1,MSMemo1,Text,TextToConvert
Length>%TextToConvert%,InputLengA
SetDialogProperty>Dialog1,Label3,Caption,%InputLengA% Characters
END>GetLength
SRT>Stop
Let>StopFlag=1
END>Stop
SRT>Exit
Exit>1
END>Exit