Modifier une chaine de caractère dans une ligne d'un fichier
Bonjour à tous,
Je sais le sujet a été maintes fois discuté mais impossible d'arriver à faire ce que je veux.
Voila, j'ai un fichier de conf qui permet de lancer une appli:
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
| Structure Directory settings Directory settings
BEGIN
001, Path Relative Dictionary Database = "Dictionary.mdb" //Path to the dictionary database is merged with <BVSCONDIR>+<relativepath>
009, Path Relative Translation Database = "Translation.mdb" //Path to the translation database is merged with <BVSCONDIR>+<relativepath>
010, Path Relative User Database = "Benutzer.mdb" //Path to the user database is merged with <BVSCONDIR>+<relativepath>
002, List<String> Database Dir List[5] //Database files are only created in the first path. For open a database file all pathes are searched
[0] = "e:\data"
[1] = "f:\data"
[2] = "G:\data"
[3] = "C:\Data"
[4] = "W:\SIM09\11-7-2014\Data"
003, List<String> Rawdata Dir List[5] //Rawdata files are only created in the first path. For open a rawdata file all pathes are searched
[0] = "e:\Rawdata"
[1] = "f:\Rawdata"
[2] = "G:\Rawdata"
[3] = "C:\RawData"
[4] = "W:\SIM09\11-7-2014\RawData"
004, List<String> TGM Dir List[5] //TGM files are only created in the first path. For open a TGM file all pathes are searched
[0] = "e:\tgm"
[1] = "f:\tgm"
[2] = "G:\tgm"
[3] = "C:\tgm"
[4] = "W:\SIM09\11-7-2014\TGM"
005, Structure WayAssignment Directories
BEGIN
001, String Base directory = "e:\Wegzuordnung" //Base directory for the wayassignment.
002, Path Relative CoursePlanDir = "Ablaufdateien" //Path to the wayassignment courseplan filedir.
003, Path Relative DayTripDir = "Tagesdateien" //Path to the wayassignment daytrip filedir.
004, Path Relative WalkPlanDir = "WalkPlan"
END
END |
Dans ce fichier, j'aimerai remplacer les 3 chaînes "W:\SIM09" par une variable issue d'un fichier ini.
Je sais lire dans un fichier ini par:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| Path = Left(WScript.ScriptFullName, InStr(WScript.ScriptFullName, WScript.ScriptName)-1)
strIniFile=Path & "Definition des chemins repertoires.ini"
Set oFs=CreateObject("Scripting.FileSystemObject")
If oFs.FileExists(strIniFile) Then
Set oFile=oFs.OpenTextFile(strIniFile)
Execute oFile.ReadAll()
Else
Msgbox "Le fichier (.ini) n'a pas été trouvé !!!"
WScript.Quit
End If
Set oFile=Nothing
Set oFs=Nothing |
Le contenu de ini, vous l'aurez compris, sera les directories que l'utilisateur renseignera. Ce sera par exemple "D:\Données\".
Merci d'avance pour votre aide.