Décidement je ne suis vraiment pas doué pour les boucles et les tests.
Je dois lire un Spool d'édition pour extraire toutes les pages 1/1 dans
un fichier de sortie, puis toutes les pages 1/2 et 2/2 dans autres
fichiers des sortie etc.
Pour l'instant je travail sur l'extraction des pages 1/1.
L'info se trouve en position 107 longueur 11 et toujours 13 lignes
aprés avoir rencontré le début de ligne.
le début de page commence par 1SAE en position 1 longueur 4
Comment tester le début de ligne puis savoir si à la ligne 13 il y a
PAGE 1/1 pour pouvoir écrir le StrIn dans le fichier de sortie
Voici la structure du fichier d'entrée:
1SAE2
No 00000000000
EUR
0
29/04/05 31/05/05
-----
- MXXXX XXXXXXXX
MR XXXXX XXXXXXXXX
-----
XXXXX
XXXXXXXX XXXXXXX XXXXX
XX XX XX XX XX
- XXXXX XXXXXXXXXXX XX
- IBAN : XXXX XXXXX XXXXX XXXXXXXXXX XX
PAGE 1/ 1
- NOUS VOUS INFORMONS DU CHANGEMENT DE NOTRE SYSTEME
INFORMATIQUE A COMPTER DU
1SAE2
No 00000000000
EUR
0
29/04/05 31/05/05
-----
- MXXXX XXXXXXXX
MR XXXXX XXXXXXXXX
-----
XXXXX
XXXXXXXX XXXXXXX XXXXX
XX XX XX XX XX
- XXXXX XXXXXXXXXXX XX
- IBAN : XXXX XXXXX XXXXX XXXXXXXXXX XX
PAGE 1/ 1
- NOUS VOUS INFORMONS DU CHANGEMENT DE NOTRE SYSTEME
INFORMATIQUE A COMPTER DU
1SAE2
No 00000000000
Option Explicit
Dim fso, objShell, A, B, CPT, fileIn, fileOut, Sline, StrIn
Set fso = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
Set fileIn = fso.OpenTextFile("C:\EDITION\DATA\EGP", 1, True)
Set fileOut = fso.OpenTextFile("C:\EDITION\DATA\EGP1P", 2,
True)'fichier de sortie 1Page
Do While not fileIn.AtEndOfStream
SLine = fileIn.ReadLine
A=Mid(Sline,1,4) 'Extraction du Block 1SAE
B=Mid(Sline,107,10) 'Extraction du Block PAGE 1/ 1
If A="1SAE" then
strIn = SLine
fileOut.WriteLine strIn
If B ="Block PAGE 1/ 1 " Then fileOut.Close
fileOut.Close
Set A = Nothing
Set B = Nothing
Set fso = Nothing
Set objShell = Nothing
Set fileIn = Nothing
Set fileOut = Nothing
Set objShell =Nothing
--
Ceci est une signature automatique de MesNews.
Site : http://www.mesnews.net
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
Georges MAUREL
Bonjour, En fait il ne faudrait ouvrir le fichier que lorsque c'est nécessaire et utiliser une variable pour indiquer que le fichier est ouvert Ainsi cela pourrait donner Option Explicit Dim fso, objShell, A, B, CPT, fileIn, fileOut, Sline, StrIn, v_ouvert Set fso = CreateObject("Scripting.FileSystemObject") Set objShell = CreateObject("WScript.Shell") Set fileIn = fso.OpenTextFile("C:EDITIONDATAEGP", 1, True) v_ouvert = false
Do While not fileIn.AtEndOfStream SLine = fileIn.ReadLine B=Mid(Sline,107,10) 'Extraction du Block PAGE 1/ 1 If Mid(Sline,1,4)="1SAE" then Set fileOut = fso.OpenTextFile("C:EDITIONDATAEGP1P", 2, True)'fichier de sortie 1Page v_ouvert = true end if
if v_ouvert = true then fileOut.WriteLine SLine end if
If Mid(Sline,107,10) ="PAGE 1/ 1 " Then fileOut.Close v_ouvert = false end if loop
if v_ouvert = true then fileOut.Close endif Set A = Nothing Set B = Nothing Set fso = Nothing Set objShell = Nothing Set fileIn = Nothing Set fileOut = Nothing Set objShell =Nothing
Cordialement Georges
"---DGI972---" <gilles.dermigny@*NOSPAM*laposte.net> a écrit dans le message de news:
Bonjour,
Décidement je ne suis vraiment pas doué pour les boucles et les tests. Je dois lire un Spool d'édition pour extraire toutes les pages 1/1 dans un fichier de sortie, puis toutes les pages 1/2 et 2/2 dans autres fichiers des sortie etc. Pour l'instant je travail sur l'extraction des pages 1/1. L'info se trouve en position 107 longueur 11 et toujours 13 lignes aprés avoir rencontré le début de ligne. le début de page commence par 1SAE en position 1 longueur 4 Comment tester le début de ligne puis savoir si à la ligne 13 il y a PAGE 1/1 pour pouvoir écrir le StrIn dans le fichier de sortie
Voici la structure du fichier d'entrée:
1SAE2 No 00000000000
EUR 0 29/04/05 31/05/05
----- - MXXXX XXXXXXXX MR XXXXX XXXXXXXXX
----- XXXXX XXXXXXXX XXXXXXX XXXXX XX XX XX XX XX
- XXXXX XXXXXXXXXXX XX - IBAN : XXXX XXXXX XXXXX XXXXXXXXXX XX
PAGE 1/ 1 - NOUS VOUS INFORMONS DU CHANGEMENT DE NOTRE SYSTEME INFORMATIQUE A COMPTER DU 1SAE2 No 00000000000
EUR 0 29/04/05 31/05/05
----- - MXXXX XXXXXXXX MR XXXXX XXXXXXXXX
----- XXXXX XXXXXXXX XXXXXXX XXXXX XX XX XX XX XX
- XXXXX XXXXXXXXXXX XX - IBAN : XXXX XXXXX XXXXX XXXXXXXXXX XX
PAGE 1/ 1 - NOUS VOUS INFORMONS DU CHANGEMENT DE NOTRE SYSTEME INFORMATIQUE A COMPTER DU 1SAE2 No 00000000000
Option Explicit Dim fso, objShell, A, B, CPT, fileIn, fileOut, Sline, StrIn Set fso = CreateObject("Scripting.FileSystemObject") Set objShell = CreateObject("WScript.Shell") Set fileIn = fso.OpenTextFile("C:EDITIONDATAEGP", 1, True) Set fileOut = fso.OpenTextFile("C:EDITIONDATAEGP1P", 2, True)'fichier de sortie 1Page
Do While not fileIn.AtEndOfStream SLine = fileIn.ReadLine A=Mid(Sline,1,4) 'Extraction du Block 1SAE B=Mid(Sline,107,10) 'Extraction du Block PAGE 1/ 1 If A="1SAE" then strIn = SLine fileOut.WriteLine strIn If B ="Block PAGE 1/ 1 " Then fileOut.Close
fileOut.Close Set A = Nothing Set B = Nothing Set fso = Nothing Set objShell = Nothing Set fileIn = Nothing Set fileOut = Nothing Set objShell =Nothing
-- Ceci est une signature automatique de MesNews. Site : http://www.mesnews.net
Bonjour,
En fait il ne faudrait ouvrir le fichier que lorsque c'est nécessaire et
utiliser une variable pour indiquer que le fichier est ouvert
Ainsi cela pourrait donner
Option Explicit
Dim fso, objShell, A, B, CPT, fileIn, fileOut, Sline, StrIn, v_ouvert
Set fso = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
Set fileIn = fso.OpenTextFile("C:EDITIONDATAEGP", 1, True)
v_ouvert = false
Do While not fileIn.AtEndOfStream
SLine = fileIn.ReadLine
B=Mid(Sline,107,10) 'Extraction du Block PAGE 1/ 1
If Mid(Sline,1,4)="1SAE" then
Set fileOut = fso.OpenTextFile("C:EDITIONDATAEGP1P", 2,
True)'fichier de sortie 1Page
v_ouvert = true
end if
if v_ouvert = true then
fileOut.WriteLine SLine
end if
If Mid(Sline,107,10) ="PAGE 1/ 1 " Then
fileOut.Close
v_ouvert = false
end if
loop
if v_ouvert = true then
fileOut.Close
endif
Set A = Nothing
Set B = Nothing
Set fso = Nothing
Set objShell = Nothing
Set fileIn = Nothing
Set fileOut = Nothing
Set objShell =Nothing
Cordialement
Georges
"---DGI972---" <gilles.dermigny@*NOSPAM*laposte.net> a écrit dans le message
de news:mn.7b347d56fc60c84f.33554@NOSPAMlaposte.net...
Bonjour,
Décidement je ne suis vraiment pas doué pour les boucles et les tests.
Je dois lire un Spool d'édition pour extraire toutes les pages 1/1 dans
un fichier de sortie, puis toutes les pages 1/2 et 2/2 dans autres
fichiers des sortie etc.
Pour l'instant je travail sur l'extraction des pages 1/1.
L'info se trouve en position 107 longueur 11 et toujours 13 lignes
aprés avoir rencontré le début de ligne.
le début de page commence par 1SAE en position 1 longueur 4
Comment tester le début de ligne puis savoir si à la ligne 13 il y a
PAGE 1/1 pour pouvoir écrir le StrIn dans le fichier de sortie
Voici la structure du fichier d'entrée:
1SAE2
No 00000000000
EUR
0
29/04/05 31/05/05
-----
- MXXXX XXXXXXXX
MR XXXXX XXXXXXXXX
-----
XXXXX
XXXXXXXX XXXXXXX XXXXX
XX XX XX XX XX
- XXXXX XXXXXXXXXXX XX
- IBAN : XXXX XXXXX XXXXX XXXXXXXXXX XX
PAGE 1/ 1
- NOUS VOUS INFORMONS DU CHANGEMENT DE NOTRE SYSTEME
INFORMATIQUE A COMPTER DU
1SAE2
No 00000000000
EUR
0
29/04/05 31/05/05
-----
- MXXXX XXXXXXXX
MR XXXXX XXXXXXXXX
-----
XXXXX
XXXXXXXX XXXXXXX XXXXX
XX XX XX XX XX
- XXXXX XXXXXXXXXXX XX
- IBAN : XXXX XXXXX XXXXX XXXXXXXXXX XX
PAGE 1/ 1
- NOUS VOUS INFORMONS DU CHANGEMENT DE NOTRE SYSTEME
INFORMATIQUE A COMPTER DU
1SAE2
No 00000000000
Option Explicit
Dim fso, objShell, A, B, CPT, fileIn, fileOut, Sline, StrIn
Set fso = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
Set fileIn = fso.OpenTextFile("C:EDITIONDATAEGP", 1, True)
Set fileOut = fso.OpenTextFile("C:EDITIONDATAEGP1P", 2,
True)'fichier de sortie 1Page
Do While not fileIn.AtEndOfStream
SLine = fileIn.ReadLine
A=Mid(Sline,1,4) 'Extraction du Block 1SAE
B=Mid(Sline,107,10) 'Extraction du Block PAGE 1/ 1
If A="1SAE" then
strIn = SLine
fileOut.WriteLine strIn
If B ="Block PAGE 1/ 1 " Then fileOut.Close
fileOut.Close
Set A = Nothing
Set B = Nothing
Set fso = Nothing
Set objShell = Nothing
Set fileIn = Nothing
Set fileOut = Nothing
Set objShell =Nothing
--
Ceci est une signature automatique de MesNews.
Site : http://www.mesnews.net
Bonjour, En fait il ne faudrait ouvrir le fichier que lorsque c'est nécessaire et utiliser une variable pour indiquer que le fichier est ouvert Ainsi cela pourrait donner Option Explicit Dim fso, objShell, A, B, CPT, fileIn, fileOut, Sline, StrIn, v_ouvert Set fso = CreateObject("Scripting.FileSystemObject") Set objShell = CreateObject("WScript.Shell") Set fileIn = fso.OpenTextFile("C:EDITIONDATAEGP", 1, True) v_ouvert = false
Do While not fileIn.AtEndOfStream SLine = fileIn.ReadLine B=Mid(Sline,107,10) 'Extraction du Block PAGE 1/ 1 If Mid(Sline,1,4)="1SAE" then Set fileOut = fso.OpenTextFile("C:EDITIONDATAEGP1P", 2, True)'fichier de sortie 1Page v_ouvert = true end if
if v_ouvert = true then fileOut.WriteLine SLine end if
If Mid(Sline,107,10) ="PAGE 1/ 1 " Then fileOut.Close v_ouvert = false end if loop
if v_ouvert = true then fileOut.Close endif Set A = Nothing Set B = Nothing Set fso = Nothing Set objShell = Nothing Set fileIn = Nothing Set fileOut = Nothing Set objShell =Nothing
Cordialement Georges
"---DGI972---" <gilles.dermigny@*NOSPAM*laposte.net> a écrit dans le message de news:
Bonjour,
Décidement je ne suis vraiment pas doué pour les boucles et les tests. Je dois lire un Spool d'édition pour extraire toutes les pages 1/1 dans un fichier de sortie, puis toutes les pages 1/2 et 2/2 dans autres fichiers des sortie etc. Pour l'instant je travail sur l'extraction des pages 1/1. L'info se trouve en position 107 longueur 11 et toujours 13 lignes aprés avoir rencontré le début de ligne. le début de page commence par 1SAE en position 1 longueur 4 Comment tester le début de ligne puis savoir si à la ligne 13 il y a PAGE 1/1 pour pouvoir écrir le StrIn dans le fichier de sortie
Voici la structure du fichier d'entrée:
1SAE2 No 00000000000
EUR 0 29/04/05 31/05/05
----- - MXXXX XXXXXXXX MR XXXXX XXXXXXXXX
----- XXXXX XXXXXXXX XXXXXXX XXXXX XX XX XX XX XX
- XXXXX XXXXXXXXXXX XX - IBAN : XXXX XXXXX XXXXX XXXXXXXXXX XX
PAGE 1/ 1 - NOUS VOUS INFORMONS DU CHANGEMENT DE NOTRE SYSTEME INFORMATIQUE A COMPTER DU 1SAE2 No 00000000000
EUR 0 29/04/05 31/05/05
----- - MXXXX XXXXXXXX MR XXXXX XXXXXXXXX
----- XXXXX XXXXXXXX XXXXXXX XXXXX XX XX XX XX XX
- XXXXX XXXXXXXXXXX XX - IBAN : XXXX XXXXX XXXXX XXXXXXXXXX XX
PAGE 1/ 1 - NOUS VOUS INFORMONS DU CHANGEMENT DE NOTRE SYSTEME INFORMATIQUE A COMPTER DU 1SAE2 No 00000000000
Option Explicit Dim fso, objShell, A, B, CPT, fileIn, fileOut, Sline, StrIn Set fso = CreateObject("Scripting.FileSystemObject") Set objShell = CreateObject("WScript.Shell") Set fileIn = fso.OpenTextFile("C:EDITIONDATAEGP", 1, True) Set fileOut = fso.OpenTextFile("C:EDITIONDATAEGP1P", 2, True)'fichier de sortie 1Page
Do While not fileIn.AtEndOfStream SLine = fileIn.ReadLine A=Mid(Sline,1,4) 'Extraction du Block 1SAE B=Mid(Sline,107,10) 'Extraction du Block PAGE 1/ 1 If A="1SAE" then strIn = SLine fileOut.WriteLine strIn If B ="Block PAGE 1/ 1 " Then fileOut.Close
fileOut.Close Set A = Nothing Set B = Nothing Set fso = Nothing Set objShell = Nothing Set fileIn = Nothing Set fileOut = Nothing Set objShell =Nothing
-- Ceci est une signature automatique de MesNews. Site : http://www.mesnews.net
---DGI972---
Georges MAUREL a exprimé avec précision :
Bonjour, En fait il ne faudrait ouvrir le fichier que lorsque c'est nécessaire et utiliser une variable pour indiquer que le fichier est ouvert Ainsi cela pourrait donner Option Explicit Dim fso, objShell, A, B, CPT, fileIn, fileOut, Sline, StrIn, v_ouvert Set fso = CreateObject("Scripting.FileSystemObject") Set objShell = CreateObject("WScript.Shell") Set fileIn = fso.OpenTextFile("C:EDITIONDATAEGP", 1, True) v_ouvert = false
Do While not fileIn.AtEndOfStream SLine = fileIn.ReadLine B=Mid(Sline,107,10) 'Extraction du Block PAGE 1/ 1 If Mid(Sline,1,4)="1SAE" then Set fileOut = fso.OpenTextFile("C:EDITIONDATAEGP1P", 2, True)'fichier de sortie 1Page v_ouvert = true end if
if v_ouvert = true then fileOut.WriteLine SLine end if
If Mid(Sline,107,10) ="PAGE 1/ 1 " Then fileOut.Close v_ouvert = false end if loop
if v_ouvert = true then fileOut.Close endif Set A = Nothing Set B = Nothing Set fso = Nothing Set objShell = Nothing Set fileIn = Nothing Set fileOut = Nothing Set objShell =Nothing
Cordialement Georges
"---DGI972---" <gilles.dermigny@*NOSPAM*laposte.net> a écrit dans le message de news:
Bonjour,
Décidement je ne suis vraiment pas doué pour les boucles et les tests. Je dois lire un Spool d'édition pour extraire toutes les pages 1/1 dans un fichier de sortie, puis toutes les pages 1/2 et 2/2 dans autres fichiers des sortie etc. Pour l'instant je travail sur l'extraction des pages 1/1. L'info se trouve en position 107 longueur 11 et toujours 13 lignes aprés avoir rencontré le début de ligne. le début de page commence par 1SAE en position 1 longueur 4 Comment tester le début de ligne puis savoir si à la ligne 13 il y a PAGE 1/1 pour pouvoir écrir le StrIn dans le fichier de sortie
Voici la structure du fichier d'entrée:
1SAE2 No 00000000000
EUR 0 29/04/05 31/05/05
----- - MXXXX XXXXXXXX MR XXXXX XXXXXXXXX
----- XXXXX XXXXXXXX XXXXXXX XXXXX XX XX XX XX XX
- XXXXX XXXXXXXXXXX XX - IBAN : XXXX XXXXX XXXXX XXXXXXXXXX XX
PAGE 1/ 1 - NOUS VOUS INFORMONS DU CHANGEMENT DE NOTRE SYSTEME INFORMATIQUE A COMPTER DU 1SAE2 No 00000000000
EUR 0 29/04/05 31/05/05
----- - MXXXX XXXXXXXX MR XXXXX XXXXXXXXX
----- XXXXX XXXXXXXX XXXXXXX XXXXX XX XX XX XX XX
- XXXXX XXXXXXXXXXX XX - IBAN : XXXX XXXXX XXXXX XXXXXXXXXX XX
PAGE 1/ 1 - NOUS VOUS INFORMONS DU CHANGEMENT DE NOTRE SYSTEME INFORMATIQUE A COMPTER DU 1SAE2 No 00000000000
Option Explicit Dim fso, objShell, A, B, CPT, fileIn, fileOut, Sline, StrIn Set fso = CreateObject("Scripting.FileSystemObject") Set objShell = CreateObject("WScript.Shell") Set fileIn = fso.OpenTextFile("C:EDITIONDATAEGP", 1, True) Set fileOut = fso.OpenTextFile("C:EDITIONDATAEGP1P", 2, True)'fichier de sortie 1Page
Do While not fileIn.AtEndOfStream SLine = fileIn.ReadLine A=Mid(Sline,1,4) 'Extraction du Block 1SAE B=Mid(Sline,107,10) 'Extraction du Block PAGE 1/ 1 If A="1SAE" then strIn = SLine fileOut.WriteLine strIn If B ="Block PAGE 1/ 1 " Then fileOut.Close
fileOut.Close Set A = Nothing Set B = Nothing Set fso = Nothing Set objShell = Nothing Set fileIn = Nothing Set fileOut = Nothing Set objShell =Nothing
-- Ceci est une signature automatique de MesNews. Site : http://www.mesnews.net
Bonjour,
J'etais dans une panique totale et on a trouvé une autre solution provisoire. je dois quand même continuer dans cette voie. je pense que je vais lire readline jusqu'au prochain 1SAE puis je vais travailler le block complet si c'est page 1/1 je l'écris dans le fichier 1 page si page 2/2 etc... Peut-on lire un morceau de texte dans un tableau puis faire des recherches dans la 13 iéme ligne de ce tableau et si la comparaison avec une valeur est correcte recopier la totalité du tableau dans un fichier de sortie ?
merci
-- Ceci est une signature automatique de MesNews. Site : http://www.mesnews.net
Georges MAUREL a exprimé avec précision :
Bonjour,
En fait il ne faudrait ouvrir le fichier que lorsque c'est nécessaire et
utiliser une variable pour indiquer que le fichier est ouvert
Ainsi cela pourrait donner
Option Explicit
Dim fso, objShell, A, B, CPT, fileIn, fileOut, Sline, StrIn, v_ouvert
Set fso = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
Set fileIn = fso.OpenTextFile("C:EDITIONDATAEGP", 1, True)
v_ouvert = false
Do While not fileIn.AtEndOfStream
SLine = fileIn.ReadLine
B=Mid(Sline,107,10) 'Extraction du Block PAGE 1/ 1
If Mid(Sline,1,4)="1SAE" then
Set fileOut = fso.OpenTextFile("C:EDITIONDATAEGP1P", 2,
True)'fichier de sortie 1Page
v_ouvert = true
end if
if v_ouvert = true then
fileOut.WriteLine SLine
end if
If Mid(Sline,107,10) ="PAGE 1/ 1 " Then
fileOut.Close
v_ouvert = false
end if
loop
if v_ouvert = true then
fileOut.Close
endif
Set A = Nothing
Set B = Nothing
Set fso = Nothing
Set objShell = Nothing
Set fileIn = Nothing
Set fileOut = Nothing
Set objShell =Nothing
Cordialement
Georges
"---DGI972---" <gilles.dermigny@*NOSPAM*laposte.net> a écrit dans le message
de news:mn.7b347d56fc60c84f.33554@NOSPAMlaposte.net...
Bonjour,
Décidement je ne suis vraiment pas doué pour les boucles et les tests.
Je dois lire un Spool d'édition pour extraire toutes les pages 1/1 dans
un fichier de sortie, puis toutes les pages 1/2 et 2/2 dans autres
fichiers des sortie etc.
Pour l'instant je travail sur l'extraction des pages 1/1.
L'info se trouve en position 107 longueur 11 et toujours 13 lignes
aprés avoir rencontré le début de ligne.
le début de page commence par 1SAE en position 1 longueur 4
Comment tester le début de ligne puis savoir si à la ligne 13 il y a
PAGE 1/1 pour pouvoir écrir le StrIn dans le fichier de sortie
Voici la structure du fichier d'entrée:
1SAE2
No 00000000000
EUR
0
29/04/05 31/05/05
-----
- MXXXX XXXXXXXX
MR XXXXX XXXXXXXXX
-----
XXXXX
XXXXXXXX XXXXXXX XXXXX
XX XX XX XX XX
- XXXXX XXXXXXXXXXX XX
- IBAN : XXXX XXXXX XXXXX XXXXXXXXXX XX
PAGE 1/ 1
- NOUS VOUS INFORMONS DU CHANGEMENT DE NOTRE SYSTEME
INFORMATIQUE A COMPTER DU
1SAE2
No 00000000000
EUR
0
29/04/05 31/05/05
-----
- MXXXX XXXXXXXX
MR XXXXX XXXXXXXXX
-----
XXXXX
XXXXXXXX XXXXXXX XXXXX
XX XX XX XX XX
- XXXXX XXXXXXXXXXX XX
- IBAN : XXXX XXXXX XXXXX XXXXXXXXXX XX
PAGE 1/ 1
- NOUS VOUS INFORMONS DU CHANGEMENT DE NOTRE SYSTEME
INFORMATIQUE A COMPTER DU
1SAE2
No 00000000000
Option Explicit
Dim fso, objShell, A, B, CPT, fileIn, fileOut, Sline, StrIn
Set fso = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
Set fileIn = fso.OpenTextFile("C:EDITIONDATAEGP", 1, True)
Set fileOut = fso.OpenTextFile("C:EDITIONDATAEGP1P", 2,
True)'fichier de sortie 1Page
Do While not fileIn.AtEndOfStream
SLine = fileIn.ReadLine
A=Mid(Sline,1,4) 'Extraction du Block 1SAE
B=Mid(Sline,107,10) 'Extraction du Block PAGE 1/ 1
If A="1SAE" then
strIn = SLine
fileOut.WriteLine strIn
If B ="Block PAGE 1/ 1 " Then fileOut.Close
fileOut.Close
Set A = Nothing
Set B = Nothing
Set fso = Nothing
Set objShell = Nothing
Set fileIn = Nothing
Set fileOut = Nothing
Set objShell =Nothing
--
Ceci est une signature automatique de MesNews.
Site : http://www.mesnews.net
Bonjour,
J'etais dans une panique totale et on a trouvé une autre solution
provisoire.
je dois quand même continuer dans cette voie.
je pense que je vais lire readline jusqu'au prochain 1SAE
puis je vais travailler le block complet si c'est page 1/1 je l'écris
dans le fichier 1 page si page 2/2 etc...
Peut-on lire un morceau de texte dans un tableau puis faire des
recherches dans la 13 iéme ligne de ce tableau et si la comparaison
avec une valeur est correcte recopier la totalité du tableau dans un
fichier de sortie ?
merci
--
Ceci est une signature automatique de MesNews.
Site : http://www.mesnews.net
Bonjour, En fait il ne faudrait ouvrir le fichier que lorsque c'est nécessaire et utiliser une variable pour indiquer que le fichier est ouvert Ainsi cela pourrait donner Option Explicit Dim fso, objShell, A, B, CPT, fileIn, fileOut, Sline, StrIn, v_ouvert Set fso = CreateObject("Scripting.FileSystemObject") Set objShell = CreateObject("WScript.Shell") Set fileIn = fso.OpenTextFile("C:EDITIONDATAEGP", 1, True) v_ouvert = false
Do While not fileIn.AtEndOfStream SLine = fileIn.ReadLine B=Mid(Sline,107,10) 'Extraction du Block PAGE 1/ 1 If Mid(Sline,1,4)="1SAE" then Set fileOut = fso.OpenTextFile("C:EDITIONDATAEGP1P", 2, True)'fichier de sortie 1Page v_ouvert = true end if
if v_ouvert = true then fileOut.WriteLine SLine end if
If Mid(Sline,107,10) ="PAGE 1/ 1 " Then fileOut.Close v_ouvert = false end if loop
if v_ouvert = true then fileOut.Close endif Set A = Nothing Set B = Nothing Set fso = Nothing Set objShell = Nothing Set fileIn = Nothing Set fileOut = Nothing Set objShell =Nothing
Cordialement Georges
"---DGI972---" <gilles.dermigny@*NOSPAM*laposte.net> a écrit dans le message de news:
Bonjour,
Décidement je ne suis vraiment pas doué pour les boucles et les tests. Je dois lire un Spool d'édition pour extraire toutes les pages 1/1 dans un fichier de sortie, puis toutes les pages 1/2 et 2/2 dans autres fichiers des sortie etc. Pour l'instant je travail sur l'extraction des pages 1/1. L'info se trouve en position 107 longueur 11 et toujours 13 lignes aprés avoir rencontré le début de ligne. le début de page commence par 1SAE en position 1 longueur 4 Comment tester le début de ligne puis savoir si à la ligne 13 il y a PAGE 1/1 pour pouvoir écrir le StrIn dans le fichier de sortie
Voici la structure du fichier d'entrée:
1SAE2 No 00000000000
EUR 0 29/04/05 31/05/05
----- - MXXXX XXXXXXXX MR XXXXX XXXXXXXXX
----- XXXXX XXXXXXXX XXXXXXX XXXXX XX XX XX XX XX
- XXXXX XXXXXXXXXXX XX - IBAN : XXXX XXXXX XXXXX XXXXXXXXXX XX
PAGE 1/ 1 - NOUS VOUS INFORMONS DU CHANGEMENT DE NOTRE SYSTEME INFORMATIQUE A COMPTER DU 1SAE2 No 00000000000
EUR 0 29/04/05 31/05/05
----- - MXXXX XXXXXXXX MR XXXXX XXXXXXXXX
----- XXXXX XXXXXXXX XXXXXXX XXXXX XX XX XX XX XX
- XXXXX XXXXXXXXXXX XX - IBAN : XXXX XXXXX XXXXX XXXXXXXXXX XX
PAGE 1/ 1 - NOUS VOUS INFORMONS DU CHANGEMENT DE NOTRE SYSTEME INFORMATIQUE A COMPTER DU 1SAE2 No 00000000000
Option Explicit Dim fso, objShell, A, B, CPT, fileIn, fileOut, Sline, StrIn Set fso = CreateObject("Scripting.FileSystemObject") Set objShell = CreateObject("WScript.Shell") Set fileIn = fso.OpenTextFile("C:EDITIONDATAEGP", 1, True) Set fileOut = fso.OpenTextFile("C:EDITIONDATAEGP1P", 2, True)'fichier de sortie 1Page
Do While not fileIn.AtEndOfStream SLine = fileIn.ReadLine A=Mid(Sline,1,4) 'Extraction du Block 1SAE B=Mid(Sline,107,10) 'Extraction du Block PAGE 1/ 1 If A="1SAE" then strIn = SLine fileOut.WriteLine strIn If B ="Block PAGE 1/ 1 " Then fileOut.Close
fileOut.Close Set A = Nothing Set B = Nothing Set fso = Nothing Set objShell = Nothing Set fileIn = Nothing Set fileOut = Nothing Set objShell =Nothing
-- Ceci est une signature automatique de MesNews. Site : http://www.mesnews.net
Bonjour,
J'etais dans une panique totale et on a trouvé une autre solution provisoire. je dois quand même continuer dans cette voie. je pense que je vais lire readline jusqu'au prochain 1SAE puis je vais travailler le block complet si c'est page 1/1 je l'écris dans le fichier 1 page si page 2/2 etc... Peut-on lire un morceau de texte dans un tableau puis faire des recherches dans la 13 iéme ligne de ce tableau et si la comparaison avec une valeur est correcte recopier la totalité du tableau dans un fichier de sortie ?
merci
-- Ceci est une signature automatique de MesNews. Site : http://www.mesnews.net
Georges MAUREL
Bonjour, Oui il vous est tout à fait possible de dimensionner un tableau dans lequel vous allez mettre le contenu de vos lignes. Mais vous allez allonger le temps de traitement. Si vous êtes sur que ce que vous cherchez est à la ligne 13, vous pouvez stocker le contenu de vos lignes dans une variables et ajouter à chaque fois chr(13)+chr(10) Cela donnerait à peut près ceci :
ouverture du fichier en lecteur nbligne = 0 v_lignesortie = "" v_ligneentree = "" tant que pas fin de fichier lecture ligne dans v_ligneentree nbligne = nbligne + 1 si nbligne = 13 alors test de la valeur v_lignesortie = vlignesortie + chr(13)+chr(10) + v_ligneentree creation du fichier en sortie ecriture dans fichier en sortie avec "write" fermeture fichier en sortie v_lignesortie = "" nbligne = 0 sinon v_lignesortie = vlignesortie + chr(13)+chr(10) + v_ligneentree fin si fin tant que
Voila la trame que vous pourriez utiliser
Cordialement Georges
"---DGI972---" <gilles.dermigny@*NO SPAM* laposte.net> a écrit dans le message de news:
Georges MAUREL a exprimé avec précision :
Bonjour, En fait il ne faudrait ouvrir le fichier que lorsque c'est nécessaire et utiliser une variable pour indiquer que le fichier est ouvert Ainsi cela pourrait donner Option Explicit Dim fso, objShell, A, B, CPT, fileIn, fileOut, Sline, StrIn, v_ouvert Set fso = CreateObject("Scripting.FileSystemObject") Set objShell = CreateObject("WScript.Shell") Set fileIn = fso.OpenTextFile("C:EDITIONDATAEGP", 1, True) v_ouvert = false
Do While not fileIn.AtEndOfStream SLine = fileIn.ReadLine B=Mid(Sline,107,10) 'Extraction du Block PAGE 1/ 1 If Mid(Sline,1,4)="1SAE" then Set fileOut = fso.OpenTextFile("C:EDITIONDATAEGP1P", 2, True)'fichier de sortie 1Page v_ouvert = true end if
if v_ouvert = true then fileOut.WriteLine SLine end if
If Mid(Sline,107,10) ="PAGE 1/ 1 " Then fileOut.Close v_ouvert = false end if loop
if v_ouvert = true then fileOut.Close endif Set A = Nothing Set B = Nothing Set fso = Nothing Set objShell = Nothing Set fileIn = Nothing Set fileOut = Nothing Set objShell =Nothing
Cordialement Georges
"---DGI972---" <gilles.dermigny@*NOSPAM*laposte.net> a écrit dans le message
de news:
Bonjour,
Décidement je ne suis vraiment pas doué pour les boucles et les tests. Je dois lire un Spool d'édition pour extraire toutes les pages 1/1 dans un fichier de sortie, puis toutes les pages 1/2 et 2/2 dans autres fichiers des sortie etc. Pour l'instant je travail sur l'extraction des pages 1/1. L'info se trouve en position 107 longueur 11 et toujours 13 lignes aprés avoir rencontré le début de ligne. le début de page commence par 1SAE en position 1 longueur 4 Comment tester le début de ligne puis savoir si à la ligne 13 il y a PAGE 1/1 pour pouvoir écrir le StrIn dans le fichier de sortie
Voici la structure du fichier d'entrée:
1SAE2 No 00000000000
EUR 0 29/04/05 31/05/05
----- - MXXXX XXXXXXXX MR XXXXX XXXXXXXXX
----- XXXXX XXXXXXXX XXXXXXX XXXXX XX XX XX XX XX
- XXXXX XXXXXXXXXXX XX - IBAN : XXXX XXXXX XXXXX XXXXXXXXXX XX
PAGE 1/ 1 - NOUS VOUS INFORMONS DU CHANGEMENT DE NOTRE SYSTEME INFORMATIQUE A COMPTER DU 1SAE2 No 00000000000
EUR 0 29/04/05 31/05/05
----- - MXXXX XXXXXXXX MR XXXXX XXXXXXXXX
----- XXXXX XXXXXXXX XXXXXXX XXXXX XX XX XX XX XX
- XXXXX XXXXXXXXXXX XX - IBAN : XXXX XXXXX XXXXX XXXXXXXXXX XX
PAGE 1/ 1 - NOUS VOUS INFORMONS DU CHANGEMENT DE NOTRE SYSTEME INFORMATIQUE A COMPTER DU 1SAE2 No 00000000000
Option Explicit Dim fso, objShell, A, B, CPT, fileIn, fileOut, Sline, StrIn Set fso = CreateObject("Scripting.FileSystemObject") Set objShell = CreateObject("WScript.Shell") Set fileIn = fso.OpenTextFile("C:EDITIONDATAEGP", 1, True) Set fileOut = fso.OpenTextFile("C:EDITIONDATAEGP1P", 2, True)'fichier de sortie 1Page
Do While not fileIn.AtEndOfStream SLine = fileIn.ReadLine A=Mid(Sline,1,4) 'Extraction du Block 1SAE B=Mid(Sline,107,10) 'Extraction du Block PAGE 1/ 1 If A="1SAE" then strIn = SLine fileOut.WriteLine strIn If B ="Block PAGE 1/ 1 " Then fileOut.Close
fileOut.Close Set A = Nothing Set B = Nothing Set fso = Nothing Set objShell = Nothing Set fileIn = Nothing Set fileOut = Nothing Set objShell =Nothing
-- Ceci est une signature automatique de MesNews. Site : http://www.mesnews.net
Bonjour,
J'etais dans une panique totale et on a trouvé une autre solution provisoire. je dois quand même continuer dans cette voie. je pense que je vais lire readline jusqu'au prochain 1SAE puis je vais travailler le block complet si c'est page 1/1 je l'écris dans le fichier 1 page si page 2/2 etc... Peut-on lire un morceau de texte dans un tableau puis faire des recherches dans la 13 iéme ligne de ce tableau et si la comparaison avec une valeur est correcte recopier la totalité du tableau dans un fichier de sortie ?
merci
-- Ceci est une signature automatique de MesNews. Site : http://www.mesnews.net
Bonjour,
Oui il vous est tout à fait possible de dimensionner un tableau dans lequel
vous allez mettre le contenu de vos lignes. Mais vous allez allonger le
temps de traitement. Si vous êtes sur que ce que vous cherchez est à la
ligne 13, vous pouvez stocker le contenu de vos lignes dans une variables et
ajouter à chaque fois chr(13)+chr(10)
Cela donnerait à peut près ceci :
ouverture du fichier en lecteur
nbligne = 0
v_lignesortie = ""
v_ligneentree = ""
tant que pas fin de fichier
lecture ligne dans v_ligneentree
nbligne = nbligne + 1
si nbligne = 13 alors
test de la valeur
v_lignesortie = vlignesortie + chr(13)+chr(10) + v_ligneentree
creation du fichier en sortie
ecriture dans fichier en sortie avec "write"
fermeture fichier en sortie
v_lignesortie = ""
nbligne = 0
sinon
v_lignesortie = vlignesortie + chr(13)+chr(10) + v_ligneentree
fin si
fin tant que
Voila la trame que vous pourriez utiliser
Cordialement
Georges
"---DGI972---" <gilles.dermigny@*NO SPAM* laposte.net> a écrit dans le
message de news:mn.917c7d56e36fd312.33384@NOSPAMlaposte.net...
Georges MAUREL a exprimé avec précision :
Bonjour,
En fait il ne faudrait ouvrir le fichier que lorsque c'est nécessaire et
utiliser une variable pour indiquer que le fichier est ouvert
Ainsi cela pourrait donner
Option Explicit
Dim fso, objShell, A, B, CPT, fileIn, fileOut, Sline, StrIn, v_ouvert
Set fso = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
Set fileIn = fso.OpenTextFile("C:EDITIONDATAEGP", 1, True)
v_ouvert = false
Do While not fileIn.AtEndOfStream
SLine = fileIn.ReadLine
B=Mid(Sline,107,10) 'Extraction du Block PAGE 1/ 1
If Mid(Sline,1,4)="1SAE" then
Set fileOut = fso.OpenTextFile("C:EDITIONDATAEGP1P", 2,
True)'fichier de sortie 1Page
v_ouvert = true
end if
if v_ouvert = true then
fileOut.WriteLine SLine
end if
If Mid(Sline,107,10) ="PAGE 1/ 1 " Then
fileOut.Close
v_ouvert = false
end if
loop
if v_ouvert = true then
fileOut.Close
endif
Set A = Nothing
Set B = Nothing
Set fso = Nothing
Set objShell = Nothing
Set fileIn = Nothing
Set fileOut = Nothing
Set objShell =Nothing
Cordialement
Georges
"---DGI972---" <gilles.dermigny@*NOSPAM*laposte.net> a écrit dans le
message
de news:mn.7b347d56fc60c84f.33554@NOSPAMlaposte.net...
Bonjour,
Décidement je ne suis vraiment pas doué pour les boucles et les tests.
Je dois lire un Spool d'édition pour extraire toutes les pages 1/1 dans
un fichier de sortie, puis toutes les pages 1/2 et 2/2 dans autres
fichiers des sortie etc.
Pour l'instant je travail sur l'extraction des pages 1/1.
L'info se trouve en position 107 longueur 11 et toujours 13 lignes
aprés avoir rencontré le début de ligne.
le début de page commence par 1SAE en position 1 longueur 4
Comment tester le début de ligne puis savoir si à la ligne 13 il y a
PAGE 1/1 pour pouvoir écrir le StrIn dans le fichier de sortie
Voici la structure du fichier d'entrée:
1SAE2
No 00000000000
EUR
0
29/04/05 31/05/05
-----
- MXXXX XXXXXXXX
MR XXXXX XXXXXXXXX
-----
XXXXX
XXXXXXXX XXXXXXX XXXXX
XX XX XX XX XX
- XXXXX XXXXXXXXXXX XX
- IBAN : XXXX XXXXX XXXXX XXXXXXXXXX XX
PAGE 1/ 1
- NOUS VOUS INFORMONS DU CHANGEMENT DE NOTRE SYSTEME
INFORMATIQUE A COMPTER DU
1SAE2
No 00000000000
EUR
0
29/04/05 31/05/05
-----
- MXXXX XXXXXXXX
MR XXXXX XXXXXXXXX
-----
XXXXX
XXXXXXXX XXXXXXX XXXXX
XX XX XX XX XX
- XXXXX XXXXXXXXXXX XX
- IBAN : XXXX XXXXX XXXXX XXXXXXXXXX XX
PAGE 1/ 1
- NOUS VOUS INFORMONS DU CHANGEMENT DE NOTRE SYSTEME
INFORMATIQUE A COMPTER DU
1SAE2
No 00000000000
Option Explicit
Dim fso, objShell, A, B, CPT, fileIn, fileOut, Sline, StrIn
Set fso = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
Set fileIn = fso.OpenTextFile("C:EDITIONDATAEGP", 1, True)
Set fileOut = fso.OpenTextFile("C:EDITIONDATAEGP1P", 2,
True)'fichier de sortie 1Page
Do While not fileIn.AtEndOfStream
SLine = fileIn.ReadLine
A=Mid(Sline,1,4) 'Extraction du Block 1SAE
B=Mid(Sline,107,10) 'Extraction du Block PAGE 1/ 1
If A="1SAE" then
strIn = SLine
fileOut.WriteLine strIn
If B ="Block PAGE 1/ 1 " Then fileOut.Close
fileOut.Close
Set A = Nothing
Set B = Nothing
Set fso = Nothing
Set objShell = Nothing
Set fileIn = Nothing
Set fileOut = Nothing
Set objShell =Nothing
--
Ceci est une signature automatique de MesNews.
Site : http://www.mesnews.net
Bonjour,
J'etais dans une panique totale et on a trouvé une autre solution
provisoire.
je dois quand même continuer dans cette voie.
je pense que je vais lire readline jusqu'au prochain 1SAE
puis je vais travailler le block complet si c'est page 1/1 je l'écris
dans le fichier 1 page si page 2/2 etc...
Peut-on lire un morceau de texte dans un tableau puis faire des
recherches dans la 13 iéme ligne de ce tableau et si la comparaison
avec une valeur est correcte recopier la totalité du tableau dans un
fichier de sortie ?
merci
--
Ceci est une signature automatique de MesNews.
Site : http://www.mesnews.net
Bonjour, Oui il vous est tout à fait possible de dimensionner un tableau dans lequel vous allez mettre le contenu de vos lignes. Mais vous allez allonger le temps de traitement. Si vous êtes sur que ce que vous cherchez est à la ligne 13, vous pouvez stocker le contenu de vos lignes dans une variables et ajouter à chaque fois chr(13)+chr(10) Cela donnerait à peut près ceci :
ouverture du fichier en lecteur nbligne = 0 v_lignesortie = "" v_ligneentree = "" tant que pas fin de fichier lecture ligne dans v_ligneentree nbligne = nbligne + 1 si nbligne = 13 alors test de la valeur v_lignesortie = vlignesortie + chr(13)+chr(10) + v_ligneentree creation du fichier en sortie ecriture dans fichier en sortie avec "write" fermeture fichier en sortie v_lignesortie = "" nbligne = 0 sinon v_lignesortie = vlignesortie + chr(13)+chr(10) + v_ligneentree fin si fin tant que
Voila la trame que vous pourriez utiliser
Cordialement Georges
"---DGI972---" <gilles.dermigny@*NO SPAM* laposte.net> a écrit dans le message de news:
Georges MAUREL a exprimé avec précision :
Bonjour, En fait il ne faudrait ouvrir le fichier que lorsque c'est nécessaire et utiliser une variable pour indiquer que le fichier est ouvert Ainsi cela pourrait donner Option Explicit Dim fso, objShell, A, B, CPT, fileIn, fileOut, Sline, StrIn, v_ouvert Set fso = CreateObject("Scripting.FileSystemObject") Set objShell = CreateObject("WScript.Shell") Set fileIn = fso.OpenTextFile("C:EDITIONDATAEGP", 1, True) v_ouvert = false
Do While not fileIn.AtEndOfStream SLine = fileIn.ReadLine B=Mid(Sline,107,10) 'Extraction du Block PAGE 1/ 1 If Mid(Sline,1,4)="1SAE" then Set fileOut = fso.OpenTextFile("C:EDITIONDATAEGP1P", 2, True)'fichier de sortie 1Page v_ouvert = true end if
if v_ouvert = true then fileOut.WriteLine SLine end if
If Mid(Sline,107,10) ="PAGE 1/ 1 " Then fileOut.Close v_ouvert = false end if loop
if v_ouvert = true then fileOut.Close endif Set A = Nothing Set B = Nothing Set fso = Nothing Set objShell = Nothing Set fileIn = Nothing Set fileOut = Nothing Set objShell =Nothing
Cordialement Georges
"---DGI972---" <gilles.dermigny@*NOSPAM*laposte.net> a écrit dans le message
de news:
Bonjour,
Décidement je ne suis vraiment pas doué pour les boucles et les tests. Je dois lire un Spool d'édition pour extraire toutes les pages 1/1 dans un fichier de sortie, puis toutes les pages 1/2 et 2/2 dans autres fichiers des sortie etc. Pour l'instant je travail sur l'extraction des pages 1/1. L'info se trouve en position 107 longueur 11 et toujours 13 lignes aprés avoir rencontré le début de ligne. le début de page commence par 1SAE en position 1 longueur 4 Comment tester le début de ligne puis savoir si à la ligne 13 il y a PAGE 1/1 pour pouvoir écrir le StrIn dans le fichier de sortie
Voici la structure du fichier d'entrée:
1SAE2 No 00000000000
EUR 0 29/04/05 31/05/05
----- - MXXXX XXXXXXXX MR XXXXX XXXXXXXXX
----- XXXXX XXXXXXXX XXXXXXX XXXXX XX XX XX XX XX
- XXXXX XXXXXXXXXXX XX - IBAN : XXXX XXXXX XXXXX XXXXXXXXXX XX
PAGE 1/ 1 - NOUS VOUS INFORMONS DU CHANGEMENT DE NOTRE SYSTEME INFORMATIQUE A COMPTER DU 1SAE2 No 00000000000
EUR 0 29/04/05 31/05/05
----- - MXXXX XXXXXXXX MR XXXXX XXXXXXXXX
----- XXXXX XXXXXXXX XXXXXXX XXXXX XX XX XX XX XX
- XXXXX XXXXXXXXXXX XX - IBAN : XXXX XXXXX XXXXX XXXXXXXXXX XX
PAGE 1/ 1 - NOUS VOUS INFORMONS DU CHANGEMENT DE NOTRE SYSTEME INFORMATIQUE A COMPTER DU 1SAE2 No 00000000000
Option Explicit Dim fso, objShell, A, B, CPT, fileIn, fileOut, Sline, StrIn Set fso = CreateObject("Scripting.FileSystemObject") Set objShell = CreateObject("WScript.Shell") Set fileIn = fso.OpenTextFile("C:EDITIONDATAEGP", 1, True) Set fileOut = fso.OpenTextFile("C:EDITIONDATAEGP1P", 2, True)'fichier de sortie 1Page
Do While not fileIn.AtEndOfStream SLine = fileIn.ReadLine A=Mid(Sline,1,4) 'Extraction du Block 1SAE B=Mid(Sline,107,10) 'Extraction du Block PAGE 1/ 1 If A="1SAE" then strIn = SLine fileOut.WriteLine strIn If B ="Block PAGE 1/ 1 " Then fileOut.Close
fileOut.Close Set A = Nothing Set B = Nothing Set fso = Nothing Set objShell = Nothing Set fileIn = Nothing Set fileOut = Nothing Set objShell =Nothing
-- Ceci est une signature automatique de MesNews. Site : http://www.mesnews.net
Bonjour,
J'etais dans une panique totale et on a trouvé une autre solution provisoire. je dois quand même continuer dans cette voie. je pense que je vais lire readline jusqu'au prochain 1SAE puis je vais travailler le block complet si c'est page 1/1 je l'écris dans le fichier 1 page si page 2/2 etc... Peut-on lire un morceau de texte dans un tableau puis faire des recherches dans la 13 iéme ligne de ce tableau et si la comparaison avec une valeur est correcte recopier la totalité du tableau dans un fichier de sortie ?
merci
-- Ceci est une signature automatique de MesNews. Site : http://www.mesnews.net