Salut
J'ai un pb lors d'une modif d'un fichier texte
J'ai besoin de changer des valeurs dans certaines cellules mais dans mon code la cellule AD garde les guillemets après les modifs (à cause des guillemets je pense)
";0;1;0;0;1;0.094339;0.128585;0.879012" quand je l'ouvre en textEdit,
Comment les enlever ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49 set file_Name to (path to desktop folder as string) & "Services:Factures.txt" -- Nom du fichier export set theOutputPath to (path to desktop folder as string) & "Services:Fiches.txt" -- Nom du fichier modifié pour import tell application "Microsoft Excel" -- Ouvrir excel set silently of window 1 to true set visible to false open text file filename file_Name origin Macintosh data type delimited field info {{1, text format}, {2, text format}, {3, text format}, {30, text format}} with tab -- Ouvrir le fichier export txt set value of cell ("A" & "1") to "**Gestion" set value of cell ("B" & "1") to "Confirmations de commande" -- Mettre dans B1 le texte set value of cell ("B" & "4") to "SARL" set value of cell ("J" & "4") to "411100" set value of cell ("K" & "4") to "" set value of cell ("AS" & "4") to cell ("L" & "4") set value of cell ("L" & "4") to "SARL " set value of cell ("M" & "4") to "2" set value of cell ("N" & "4") to "RUE XXXX" set value of cell ("P" & "4") to "BAT N°2" set value of cell ("Q" & "4") to "95000" set value of cell ("R" & "4") to "YYYYY" set value of cell ("U" & "4") to "06 82 XXXX" set value of cell ("V" & "4") to "01 78 XXXXX" set value of cell ("W" & "4") to "EEEEEEE@orange.fr" set value of cell ("X" & "4") to "FR" set value of cell ("Y" & "4") to "0249TTTTTTT" set value of cell ("AR" & "4") to "Export Facture" set value of cell ("AQ" & "4") to "ooooo" set I to 5 -- Boucle demarant à 5 repeat until (I = 100) -- jusqu'à 100 if value of cell ("B" & I) is not equal to "" then set value of cell ("B" & I) to "DIVERS" -- si B? n'est pas vide alors saisir vide (B = Code Produit) if value of cell ("B" & I) is equal to "DIVERS" then set value of cell ("AD" & I) to ";0;1;0;0;1;0.094339;0.128585;0.879012" -- Ligne qui me pose pb if value of cell ("D" & I) is not equal to "" then set value of cell ("D" & I) to "" -- D = Px Unit if value of cell ("G" & I) is not equal to "" then set value of cell ("G" & I) to "" -- G = Remise if value of cell ("H" & I) is not equal to "" then set value of cell ("H" & I) to "" -- H = Code TVA if value of cell ("I" & I) is not equal to "" then set value of cell ("I" & I) to "" -- I = Taux TVA if value of cell ("J" & I) is not equal to "" then set value of cell ("J" & I) to "" -- J = Px Achat set I to I + 1 -- augmenter la valeur de I +1 log I -- lit I end repeat -- s'arreter si I = 100 tell active workbook save workbook as filename theOutputPath file format text Mac file format with overwrite without asking -- Sauvegarder modifs dans nouveau fichier quit saving no -- fermer les fichiers excel end tell end tell
Partager