Slts,
Moulinette en VBSript pour extraire toutes les variables contenues dans tout fichier texte (ascii) à toutes fin utile.
Copier les lignes de programme ci dessous et les coller dans le bloc-notes , enregistrer sous Extracteur.vbs
Avec l’explorateur de fichiers Windows double clic sur le fichier Extracteur.vbs pour exécuter le script.
Résultats dans le fichier _RESULT_
Option explicit
Dim TXT,fileNameSource,fileNameCible,sOBJ,sVAL, sL
Dim mySize
Dim FSO,Rtxt,Wtxt
Dim oRegExp, oMatches, oMatch
'Objet Régular-expressions
Set oRegExp = CreateObject("VBScript.RegExp")
oRegExp.Global = True
oRegExp.IgnoreCase = True
fileNameSource=GetFileNameDlg()
if InStr(fileNameSource,".")=0 then
MsgBox("Fichier avec Extension obligatoire ex: *.txt")
WScript.Quit 0
end if
'Fichier résltant avec la liste des variables extraites
fileNameCible = Replace(fileNameSource, ".", "_RESULT_") & ".txt"
Set FSO = CreateObject("Scripting.FileSystemObject")
Set Rtxt = FSO.OpenTextFile(fileNameSource)
TXT=Rtxt.ReadAll
Rtxt.close
Set Wtxt = FSO.createTextFile(fileNameCible,true)
'Extrait les variables %M
sL=""
oRegExp.Pattern = "%M[0-9]+"
Set oMatches = oRegExp.Execute(TXT)
For Each oMatch In oMatches
'Anti-doublons
sVAL=oMatch.Value & "*"
if instr(sL,sVAL)= 0 then Wtxt.writeline (oMatch.Value)
sL=sL & sVAL
Next
'Extrait les variables %MD
sL=""
oRegExp.Pattern = "%MD[0-9]+"
Set oMatches = oRegExp.Execute(TXT)
For Each oMatch In oMatches
sVAL=oMatch.Value & "*"
if instr(sL,sVAL)= 0 then Wtxt.writeline (oMatch.Value)
sL=sL & sVAL
Next
'Extrait les variables %MF
sL=""
oRegExp.Pattern = "%MF[0-9]+"
Set oMatches = oRegExp.Execute(TXT)
For Each oMatch In oMatches
sVAL=oMatch.Value & "*"
if instr(sL,sVAL)= 0 then Wtxt.writeline (oMatch.Value)
sL=sL & sVAL
Next
'Extrait les variables %MWx:x
sL=""
oRegExp.Pattern = "%MW[0-9]+(:X[0-9]+)"
Set oMatches = oRegExp.Execute(TXT)
For Each oMatch In oMatches
sOBJ = oMatch.Value
TXT = Replace(TXT, sOBJ, "???")
sVAL=sOBJ
if instr(sL,sVAL)= 0 then Wtxt.writeline (oMatch.Value)
sL=sL & sVAL
Next
'Extrait les variables %MW
sL=""
oRegExp.Pattern = "%MW[0-9]+"
Set oMatches = oRegExp.Execute(TXT)
For Each oMatch In oMatches
sVAL=oMatch.Value & "*"
if instr(sL,sVAL)= 0 then Wtxt.writeline (oMatch.Value)
sL=sL & sVAL
Next
Wtxt.close
Set oRegExp = Nothing
Set oMatches =Nothing
Set oMatch =Nothing
MsgBox "Fin des opérations" , vbInformation, fileNameCible
Function GetFileNameDlg()
GetFileNameDlg=CreateObject("WScript.Shell").Exec("mshta.exe ""about:<input type=file id=f><script language=""VBScript"">f.click():CreateObject(""Scripting.FileSystemObject"").GetStandardStream(1).Write(f.value):close()</script>""").StdOut.ReadAll
End Function
Moulinette en VBSript pour extraire
- itasoft
- Mi homme - Mi automate
- Messages : 7152
- Enregistré le : 20 oct. 2015, 10:15
- Localisation : Lyon
- Contact :
Moulinette en VBSript pour extraire
Automaticien privé (de tout)
itasoft@free.fr
itasoft@free.fr
- itasoft
- Mi homme - Mi automate
- Messages : 7152
- Enregistré le : 20 oct. 2015, 10:15
- Localisation : Lyon
- Contact :
Re: Moulinette en VBSript pour traduire
Slts,
Moulinette en VBScript pour traduire dans toutes les langues les commentaires contenus dans un programme automate , c’est le texte contenu entre (* et *)
J’ai pas fais de notice d’utilisation pour cette moulinette, si le besoin se fait sentir, me contacter, (opération gratuite )
[attachment=0]CaptureMouline.JPG[/attachment]
Moulinette en VBScript pour traduire dans toutes les langues les commentaires contenus dans un programme automate , c’est le texte contenu entre (* et *)
J’ai pas fais de notice d’utilisation pour cette moulinette, si le besoin se fait sentir, me contacter, (opération gratuite )
[attachment=0]CaptureMouline.JPG[/attachment]
Automaticien privé (de tout)
itasoft@free.fr
itasoft@free.fr