[VBS HTA] Code entre 2 fichiers Texte => 2 TextBox.
Bonjour,
Le code ci-dessous travail sur 2 fichiers Texte.
Pourriez-vous m'aider à l'adapter pour un travail entre 2 TextBox d'un HTA ?
A savoir que je n'aurais qu'une seule ligne dans mes textbox
Code:
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
| Const ForReading = 1, ForWriting = 2
strScriptFile = Wscript.ScriptFullName
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile(strScriptFile)
strFolder = objFSO.GetParentFolderName(objFile)
' Replace
Set objFile = objFSO.OpenTextFile(strFolder & "\replace_this_text.txt", ForReading)
Do
strLine = strLine & objFile.ReadLine & vbCrLf
Loop While Not objFile.AtEndOfStream
objFile.Close
' Remove last ENTER added by Loop
strLine = Left(strLine, Len(strLine) - 2)
strLine = Replace_Char(strLine)
' Saving new file, with replaced text.
If Not (objFSO.FileExists(strFolder & "\replaced.txt")) Then
objFSO.CreateTextFile(strFolder & "\replaced.txt")
End If
Set objFile = objFSO.OpenTextFile(strFolder & "\replaced.txt", ForWriting)
objFile.Write(strLine)
objFile.Close
WScript.Echo strLine |