Lecture d'un fichier texte
Bonjour,
Je voudrais récupérer des données dans un fichier texte.
Je m'explique...
J'ai un fichier HTA avec un champ déroulant.
Celui-ci est incrémenté par la lecture d'un fichier texte.
Fichier texte liste.txt :
Valeur1-Valeur2
Valeur3-Valeur4
Je souhaite récupérer les valeurs après le séparateur "-".
Fichier HTA :
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
| <script language="VBScript">
Sub Window_Onload
ForReading = 1
strNewFile = "printers.txt"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile _
(strNewFile, ForReading)
Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
Set objOption = Document.createElement("OPTION")
objOption.Text = strLine
objOption.Value = strLine
AvailablePhrases.Add(objOption)
Loop
objFile.Close
XPos = 400
YPos = 300
intLeft = (intHorizontal - XPos) / 2
intTop = (intVertical - YPos) / 2
self.ResizeTo Xpos,YPos
'window.moveTo intLeft, intTop
End Sub
Sub TESTSUB
on error resume next
Selection = AvailablePhrases.Value
strPrinter = txt_printer.value |
J'ai trouvé chemin faisant ce code :
Set Selection = Mid(Ligne, 1, (InStr(Ligne, "-")-2))
Malheureusement, je ne sais pas du tout comment l'utiliser...
Pouvez-vous m'aider s'il vous plait ?