1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
| <html>
<head>
<title>My HTML application</title>
<HTA:APPLICATION
APPLICATIONNAME="My HTML application"
ID="MyHTMLapplication"
VERSION="1.0"/>
</head>
<script language="VBScript">
Sub GetCheckBox1Value()
If CheckBox1.checked Then
MsgBox "CheckBox1 is checked"
Else
MsgBox "CheckBox1 is Unchecked"
End if
End Sub
Function Corriger(TextAtraiter)
Dim RegularExpressioN, T, U
Dim ListPattern, TblPattern
Dim ListSubstit, TblSubstit
'Création de la liste des caractères a rechercher.
ListPattern = "p|ÿ|||;|-"
'Création du tableau de Pattern.
TblPattern = Split(ListPattern, "|", -1, vbTextCompare)
'Création de la liste des caractères de substitution.
ListSubstit = "P||é|ç|:|."
'création du tableau de substitution.
TblSubstit = Split(ListSubstit, "|", -1, vbTextCompare)
'################# ListSubstit2 #####################################################################################
'Création de la liste des caractères de substitution.
ListSubstit2 = "(P)|_|e|c|=|:"
'création du tableau de substitution.
TblSubstit2 = Split(ListSubstit2, "|", -1, vbTextCompare)
'##############################################################################################################
Set RegularExpressioN = New RegExp
'Appliquer le remplacement à tout le texte
RegularExpressioN.Global = True
Corriger = TextAtraiter
U = UBound(TblPattern)
For T = 0 To U
RegularExpressioN.Pattern = TblPattern(T) 'caractère(s) à rechercher
' Effectue le remplacement appliquer à tout le texte
Corriger = RegularExpressioN.Replace(Corriger, TblSubstit(T))
Next
Set RegularExpressioN = Nothing
End Function
Sub TestSub
GetCheckBox1Value
strText = MyTextArea.Value' = "paquetsÿ; envoys = 40, reus = 40-"
'Msgbox strText
strText = Corriger(strText)
'Msgbox strText
TextResult.Value = strText
End Sub
</script>
<body bgcolor="white">
<input type="checkbox" name="CheckBox1" id="CheckBox1" onclick="GetCheckBox1Value" checked=true>CheckBox1<P>
<input type="text" name="MyTextArea" value="paquetsÿ; envoys = 40, reus = 40-" size="50"><P>
<input type="text" name="TextResult" size="50"><P>
<input type="button" value="Run Script" onClick="TestSub">
</body>
</html> |
Partager