Hi,
Thanks for your answer.
Here is my script :
Option Explicit
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim ftmp, ftxt, sep, deb, fin, chaine, txt, item, msg, motdeb, lgdeb, motfin
Dim objArgs, fname, fso, f, fstr
' Initialisation *********************
motdeb = "OOOO"
motfin = "OOOO"
sep = " "
chaine = "noged"
Set objArgs = WScript.Arguments
' Contrôles ************************
If objArgs.Count = 0 Then
MsgBox "This script needs a parameter!", vbExclamation, "Recherche avant"
WScript.Quit
End If
fname = objArgs(0) ' contient le nom du fichier à imprimer
msgbox("le fichier : " & fname)
' Lecture du contenu du fichier à imprimer
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(fname, ForReading,,-1)
fstr = f.ReadAll
msgbox("le texte : " & fstr)
' Recherche d'une chaine bornée par motdeb et motfin contenant des paramètres séparés par sep
lgdeb = len(motdeb)
deb = InStr(1,fstr,motdeb)
fin = InStr(deb+lgdeb,fstr,motfin)
msgbox("début = " & deb & chr(13) & "fin = " & fin)
If deb<>0 Then ' la chaine est trouvée
chaine = Mid(fstr,deb+lgdeb,fin-deb-lgdeb)
msg = chaine & chr(13)
txt = Split(chaine," ")
for each item in txt
msg = msg & item & chr(13)
next
msgbox ("propriétés :" & chr(13) & msg)
End If
f.Close
' Ecriture d'un fichier temporaire de paramètres destinés à la GED
ftmp = "\" & "GEDIC-" & objArgs(1) & objArgs(2) & ".txt" ' objArgs(1)= objArgs(2)=
msgbox(ftmp)
ftxt = chaine
msgbox(ftxt)
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(ftmp, ForWriting, True)
f.Write ftxt
f.Close