set lecal to display dialog "Entrer le nom du calendrier :" default answer "Personnel"
set lecal to text returned of result
set ladate to display dialog "Entrer la date de début :" default answer "JJ/MM/AAAA"
set ladate to text returned of result
set lejour to date ladate
set fin to lejour + (1 * days)
set nbjour to display dialog "Entrer le nombre de jours :" default answer "1"
set nbjour to text returned of result
set lefich to ""
tell application "Calendar"
    tell calendar lecal
      
        repeat with i from 1 to nbjour
          
            set theEventList to (every event whose (start date > lejour and end date < fin))
          
            set nbevent to count of theEventList
            repeat with j from 1 to nbevent
                set a to summary of item j of theEventList
                --set a to a as string
                set b to description of item j of theEventList
                --set b to b as string
              
                if b = missing value then set b to "---"
              
                set c to start date of item j of theEventList
                --set c to c as string
                set lefich to lefich & c & tab & a & tab & b & return
              
            end repeat
            set lejour to lejour + (1 * days)
            set fin to lejour + (1 * days)
        end repeat
        display dialog lefich
    end tell
end tell
tell application "Finder"
    set lelog to open for access ((path to desktop folder as text) & "les evenements.txt") as text with write permission
    write lefich & return to lelog starting at eof
    close access lelog
end tell
	set lecal to display dialog "Entrer le nom du calendrier :" default answer "Personnel"
set lecal to text returned of result
set ladate to display dialog "Entrer la date de début :" default answer "JJ/MM/AAAA"
set ladate to text returned of result
set lejour to date ladate
set nbjour to display dialog "Entrer le nombre de jours :" default answer "1"
set nbjour to text returned of result
set fin to lejour + (nbjour * days)
set lefich to ""
tell application "Calendar"
    tell calendar lecal
        
        set theEventList to (every event whose (start date > lejour and end date < fin))
        
        set nbevent to count of theEventList
        repeat with j from 1 to nbevent
            set a to summary of item j of theEventList
            set b to description of item j of theEventList
            
            if b = missing value then set b to "---"
            set c to start date of item j of theEventList
            
            if c is not "" then
                set lefich to lefich & c & tab & a & tab & b & return
            end if
        end repeat
        
    end tell
end tell
tell application "Finder"
    set lelog to open for access ((path to desktop folder as text) & "les evenements.txt") as text with write permission
    write lefich to lelog starting at eof
    close access lelog
end tell
	jeudi 21 mars 2024 à 00:00:00    1 pêche 7+2 1 fraise 7+3 1 myrtille 9+0    ---
vendredi 22 mars 2024 à 00:00:00    1 caramel 8+4 1 chocolat 7+4    ---
mardi 26 mars 2024 à 00:00:00    1 gingembre 8+5 1 praline 6+4    ---
vendredi 29 mars 2024 à 00:00:00    1 malaga 8+5 1 chocolat 7+5    ---
jeudi 28 mars 2024 à 00:00:00    1 vanille 7+5 1 fadoli 9+0    ---
lundi 1 avril 2024 à 00:00:00    1 citron 8+5    ---
vendredi 5 avril 2024 à 13:30:00    Livraison 3 bouteilles de gaz Midi Gaz (Peut-être entre 12 et 14h, mais probablement avant)    ---
vendredi 5 avril 2024 à 00:00:00    1 cerise 5+3 1 abricot 8+0 1 poire 4+3    ---
jeudi 4 avril 2024 à 00:00:00    1 réglisse 7+5 1 amande 7+5    ---
lundi 8 avril 2024 à 00:00:00    2 cacao 13+6    ---
mardi 9 avril 2024 à 00:00:00    1 café 7+5 1 chocolat 7+5    ---
jeudi 11 avril 2024 à 00:00:00    1 vanille 8+3 1 praline 8+0    ---
vendredi 12 avril 2024 à 00:00:00    1 pêche 8+0 1 prune 11+2 1 figue 7+0    ---
lundi 15 avril 2024 à 00:00:00    1 orange 8+2    ---
mardi 16 avril 2024 à 00:00:00    1 zeste de lune 8+3 1 fadoli 9+1    ---
jeudi 18 avril 2024 à 00:00:00    1 gingembre 8+3 1 cannelle 9+1    ---
vendredi 19 avril 2024 à 00:00:00    1 poire 6+3 1 fraise 6+3 1 cerise 4+4    ---
lundi 22 avril 2024 à 00:00:00    1 thym 7+5 1 amande 8+4    ---
mardi 23 avril 2024 à 00:00:00    1 caramel 10+0 1 chocolat 9+0    ---
jeudi 25 avril 2024 à 00:00:00    1 vanille 7+5 1 thym 9+1    ---
vendredi 26 avril 2024 à 00:00:00    1 citron    ---
lundi 29 avril 2024 à 00:00:00    1 pêche 8+0 1 figue 6+3 1 myrtille 7+3    ---
mercredi 1 mai 2024 à 00:00:00    1 café 9+0
1 praline 8+0    ---
jeudi 2 mai 2024 à 00:00:00    1 malaga 7+6 1 chocolat 8+    ---
vendredi 3 mai 2024 à 00:00:00    1 vanille xxx 1 fadoli yyyy    ---
lundi 6 mai 2024 à 00:00:00    1 poire 6+3 1 cerise 6+0 1 prune 8+0    ---
mercredi 8 mai 2024 à 00:00:00    1 réglisse 9+0 1 fadoli 8+3    ---
jeudi 9 mai 2024 à 00:00:00    1 vanille 7+5 1 gingembre 8+3 1 chocolat 8+3    ---
vendredi 10 mai 2024 à 00:00:00    1 vanille 7+5
1 café 8+3
1 amande 10+0    ---
mardi 14 mai 2024 à 00:00:00    1 pêche 8+0 1 Cerise 5+3 1 figue 6+2    ---
lundi 13 mai 2024 à 00:00:00    1 abricot 7+4 1 fraise 6+4 1 myrtille 7+3    ---
vendredi 17 mai 2024 à 00:00:00    1 réglisse 9+0 1 praline 7+2    ---
jeudi 16 mai 2024 à 00:00:00    1 gingembre 9+0 1 chocolat 9+0    ---
lundi 20 mai 2024 à 00:00:00    1 vanille 7+5
1 fadoli 8+3    ---
mardi 21 mai 2024 à 00:00:00    1 fraise 6+3
1 poire 6+2
1 citron 7+2    ---
jeudi 23 mai 2024 à 00:00:00    1 vanille 7+5 1 cannelle 7+4 1 amande 8+3    ---
lundi 27 mai 2024 à 00:00:00    1 caramel 8+3 2 praline 13+6    ---
mercredi 29 mai 2024 à 00:00:00    1 vanille 8+3 1 caramel 8+3 1 amande 8+3    ---
vendredi 24 mai 2024 à 00:00:00    1 cardamome 7+5 1 café 9+1 1 chocolat 8+3    ---
vendredi 31 mai 2024 à 00:00:00    Pulpe de cerise 6*4,25 + 1,6    ---
jeudi 30 mai 2024 à 00:00:00    1 pêche 7+1 1 abricot 8+1 1 orange 5+5 1 myrtille 9+0    ---
mardi 4 juin 2024 à 00:00:00    1 vanille 7+5 1 amande 10+0 1 chocolat 8+3    ---
lundi 3 juin 2024 à 00:00:00    2 cacao 13+6    ---
jeudi 6 juin 2024 à 00:00:00    1 gingembre 8+3 1 malaga 10+0 1 fadoli 8+3    ---
vendredi 7 juin 2024 à 00:00:00    1 poire 6+2 1 cerise 6+0 1 prune 8+2 1 figue 8+5    ---
lundi 10 juin 2024 à 00:00:00    1 fraise 8+1 1 pêche 7+1 1 poire 6+2 1 citron 7+4    ---
mardi 11 juin 2024 à 00:00:00    1 vanille 7+5
1 gingembre 8+3
1 fadoli 8+3    ---
mercredi 26 juin 2024 à 08:15:00    Contrôle balance - Sud Pesage    ---
jeudi 13 juin 2024 à 00:00:00    1 café 8+3 1 caramel 8+3 1 chocolat 8+3    ---
vendredi 14 juin 2024 à 00:00:00    1 myrtille 7+3
1 cerise 6+0
1 OCB 10+5    ---
lundi 17 juin 2024 à 00:00:00    2 praline 14+4 1 fadoli 8+3    ---
mardi 18 juin 2024 à 00:00:00    1 vanille 7+5 1 gingembre 8+3  fadoli 8+3    ---
	Le script prend tous les jours ou il y a un événements de renseigné !Le script prend aussi les évènements qui ne sont pas des journées de fabrication
set lecal to display dialog "Entrer le nom du calendrier :" default answer "Personnel"
set lecal to text returned of result
set ladate to display dialog "Entrer la date de début :" default answer "JJ/MM/AAAA"
set ladate to text returned of result
set lejour to date ladate
set nbjour to display dialog "Entrer le nombre de jours :" default answer "1"
set nbjour to text returned of result
set fin to lejour + (nbjour * days)
set lefich to ""
tell application "Calendar"
    tell calendar lecal
     
        set theEventList to (every event whose (start date > lejour and end date < fin))
     
        set nbevent to count of theEventList
        repeat with j from 1 to nbevent
            set a to summary of item j of theEventList
            set c to start date of item j of theEventList
         
            if c is not "" then
                set lefich to lefich & c & tab & a & " " & return
            end if
        end repeat
    end tell
end tell
tell application "Finder"
    set lelog to open for access ((path to desktop folder as text) & "les evenements.txt") as text with write permission
    write lefich to lelog starting at eof
    close access lelog
end tell
set vartoto to lefich
set lesparfums to {"caramel", "fraise", "myrtille", "chocolat", "pêche", "gingembre", "praline", "malaga", "fadoli", "citron", "cerise", "abricot", "poire", "réglisse", "amande", "cacao", "café", "prune", "figue", "orange", "zeste de lune", "cannelle", "thym", "cardamone", "pulpe de cerise"}
set nbparfums to count of lesparfums
set quantite to ""
repeat with nb from 1 to nbparfums
    set cherche to item nb of lesparfums
    set resultat to cherche & " = "
    set AppleScript's text item delimiters to cherche
 
    set nb to count text item of vartoto
 
    if nb > 1 then
        repeat with i from 2 to nb
            set trouve to text item i of vartoto
            set AppleScript's text item delimiters to " "
            set ajout to text item 2 of trouve
            set resultat to resultat & ajout
            if i is not nb then set resultat to resultat & " et "
            set AppleScript's text item delimiters to cherche
        end repeat
     
        set quantite to quantite & resultat & return
    end if
end repeat
tell application "Finder"
    set lelog to open for access ((path to desktop folder as text) & "Quantites.txt") as text with write permission
    write quantite to lelog starting at eof
    close access lelog
end tell
	
caramel = 8+4 et 10+0 et 8+3 et 8+3 et 8+3 et 8+3
fraise = 7+3 et 6+3 et 6+4 et 6+3
1 et 8+1
myrtille = 9+0 et 7+3 et 7+3 et 9+0 et 7+3
1
chocolat = 7+4 et 7+5 et 7+5 et 9+0 et 8+ et 8+3 et 9+0 et 8+3 et 8+3 et 8+3 et 8+3
pêche = 7+2 et 8+0 et 8+0 et 8+0 et 7+1 et 7+1
gingembre = 8+5 et 8+3 et 8+3 et 9+0 et 8+3 et 8+3
1 et 8+3
praline = 6+4 et 8+0 et 8+0 et 7+2 et 13+6 et 14+4
malaga = 8+5 et 7+6 et 10+0
fadoli = 9+0 et 9+1 et yyyy et 8+3 et 8+3 et 8+3 et 8+3 et 8+3 et 8+3
citron = 8+5 et
lundi et 7+2 et 7+4
cerise = 5+3 et 4+4 et 6+0 et 5+3 et 6*4,25 et 6+0 et 6+0
1
abricot = 8+0 et 7+4 et 8+1
poire = 4+3 et 6+3 et 6+3 et 6+2
1 et 6+2 et 6+2
réglisse = 7+5 et 9+0 et 9+0
amande = 7+5 et 8+4 et 10+0 et 8+3 et 8+3 et 10+0
cacao = 13+6 et 13+6
café = 7+5 et 9+0
1 et 8+3
1 et 9+1 et 8+3 et 8+3
prune = 11+2 et 8+0 et 8+2
figue = 7+0 et 6+3 et 6+2 et 8+5
orange = 8+2 et 5+5
zeste de lune = 8+3
cannelle = 9+1 et 7+4
thym = 7+5 et 9+1
pulpe de cerise = 6*4,25
jeudi 21 mars 2024 à 00:00:00    1 pêche 7+2 1 fraise 7+3 1 myrtille 9+0    ---
vendredi 22 mars 2024 à 00:00:00    1 caramel 8+4 1 chocolat 7+4    ---
mardi 26 mars 2024 à 00:00:00    1 gingembre 8+5 1 praline 6+4    ---
vendredi 29 mars 2024 à 00:00:00    1 malaga 8+5 1 chocolat 7+5    ---
jeudi 28 mars 2024 à 00:00:00    1 vanille 7+5 1 fadoli 9+0    ---
lundi 1 avril 2024 à 00:00:00    1 citron 8+5    ---
vendredi 5 avril 2024 à 13:30:00    Livraison 3 bouteilles de gaz Midi Gaz (Peut-être entre 12 et 14h, mais probablement avant)    ---
vendredi 5 avril 2024 à 00:00:00    1 cerise 5+3 1 abricot 8+0 1 poire 4+3    ---
jeudi 4 avril 2024 à 00:00:00    1 réglisse 7+5 1 amande 7+5    ---
lundi 8 avril 2024 à 00:00:00    2 cacao 13+6    ---
mardi 9 avril 2024 à 00:00:00    1 café 7+5 1 chocolat 7+5    ---
jeudi 11 avril 2024 à 00:00:00    1 vanille 8+3 1 praline 8+0    ---
vendredi 12 avril 2024 à 00:00:00    1 pêche 8+0 1 prune 11+2 1 figue 7+0    ---
lundi 15 avril 2024 à 00:00:00    1 orange 8+2    ---
mardi 16 avril 2024 à 00:00:00    1 zeste de lune 8+3 1 fadoli 9+1    ---
jeudi 18 avril 2024 à 00:00:00    1 gingembre 8+3 1 cannelle 9+1    ---
vendredi 19 avril 2024 à 00:00:00    1 poire 6+3 1 fraise 6+3 1 cerise 4+4    ---
lundi 22 avril 2024 à 00:00:00    1 thym 7+5 1 amande 8+4    ---
mardi 23 avril 2024 à 00:00:00    1 caramel 10+0 1 chocolat 9+0    ---
jeudi 25 avril 2024 à 00:00:00    1 vanille 7+5 1 thym 9+1    ---
vendredi 26 avril 2024 à 00:00:00    1 citron    ---
lundi 29 avril 2024 à 00:00:00    1 pêche 8+0 1 figue 6+3 1 myrtille 7+3    ---
mercredi 1 mai 2024 à 00:00:00    1 café 9+0
1 praline 8+0    ---
jeudi 2 mai 2024 à 00:00:00    1 malaga 7+6 1 chocolat 8+    ---
vendredi 3 mai 2024 à 00:00:00    1 vanille xxx 1 fadoli yyyy    ---
lundi 6 mai 2024 à 00:00:00    1 poire 6+3 1 cerise 6+0 1 prune 8+0    ---
mercredi 8 mai 2024 à 00:00:00    1 réglisse 9+0 1 fadoli 8+3    ---
jeudi 9 mai 2024 à 00:00:00    1 vanille 7+5 1 gingembre 8+3 1 chocolat 8+3    ---
vendredi 10 mai 2024 à 00:00:00    1 vanille 7+5
1 café 8+3
1 amande 10+0    ---
mardi 14 mai 2024 à 00:00:00    1 pêche 8+0 1 Cerise 5+3 1 figue 6+2    ---
lundi 13 mai 2024 à 00:00:00    1 abricot 7+4 1 fraise 6+4 1 myrtille 7+3    ---
vendredi 17 mai 2024 à 00:00:00    1 réglisse 9+0 1 praline 7+2    ---
jeudi 16 mai 2024 à 00:00:00    1 gingembre 9+0 1 chocolat 9+0    ---
lundi 20 mai 2024 à 00:00:00    1 vanille 7+5
1 fadoli 8+3    ---
mardi 21 mai 2024 à 00:00:00    1 fraise 6+3
1 poire 6+2
1 citron 7+2    ---
jeudi 23 mai 2024 à 00:00:00    1 vanille 7+5 1 cannelle 7+4 1 amande 8+3    ---
lundi 27 mai 2024 à 00:00:00    1 caramel 8+3 2 praline 13+6    ---
mercredi 29 mai 2024 à 00:00:00    1 vanille 8+3 1 caramel 8+3 1 amande 8+3    ---
vendredi 24 mai 2024 à 00:00:00    1 cardamome 7+5 1 café 9+1 1 chocolat 8+3    ---
vendredi 31 mai 2024 à 00:00:00    Pulpe de cerise 6*4,25 + 1,6    ---
jeudi 30 mai 2024 à 00:00:00    1 pêche 7+1 1 abricot 8+1 1 orange 5+5 1 myrtille 9+0    ---
mardi 4 juin 2024 à 00:00:00    1 vanille 7+5 1 amande 10+0 1 chocolat 8+3    ---
lundi 3 juin 2024 à 00:00:00    2 cacao 13+6    ---
jeudi 6 juin 2024 à 00:00:00    1 gingembre 8+3 1 malaga 10+0 1 fadoli 8+3    ---
vendredi 7 juin 2024 à 00:00:00    1 poire 6+2 1 cerise 6+0 1 prune 8+2 1 figue 8+5    ---
lundi 10 juin 2024 à 00:00:00    1 fraise 8+1 1 pêche 7+1 1 poire 6+2 1 citron 7+4    ---
mardi 11 juin 2024 à 00:00:00    1 vanille 7+5
1 gingembre 8+3
1 fadoli 8+3    ---
mercredi 26 juin 2024 à 08:15:00    Contrôle balance - Sud Pesage    ---
jeudi 13 juin 2024 à 00:00:00    1 café 8+3 1 caramel 8+3 1 chocolat 8+3    ---
vendredi 14 juin 2024 à 00:00:00    1 myrtille 7+3
1 cerise 6+0
1 OCB 10+5    ---
lundi 17 juin 2024 à 00:00:00    2 praline 14+4 1 fadoli 8+3    ---
mardi 18 juin 2024 à 00:00:00    1 vanille 7+5 1 gingembre 8+3  fadoli 8+3    ---
jeudi 21 mars 2024 à 00:00:00    1 pêche 7+2 1 fraise 7+3 1 myrtille 9+0 
vendredi 22 mars 2024 à 00:00:00    1 caramel 8+4 1 chocolat 7+4 
mardi 26 mars 2024 à 00:00:00    1 gingembre 8+5 1 praline 6+4 
vendredi 29 mars 2024 à 00:00:00    1 malaga 8+5 1 chocolat 7+5 
jeudi 28 mars 2024 à 00:00:00    1 vanille 7+5 1 fadoli 9+0 
lundi 1 avril 2024 à 00:00:00    1 citron 8+5 
vendredi 5 avril 2024 à 13:30:00    Livraison 3 bouteilles de gaz Midi Gaz (Peut-être entre 12 et 14h, mais probablement avant) 
vendredi 5 avril 2024 à 00:00:00    1 cerise 5+3 1 abricot 8+0 1 poire 4+3 
jeudi 4 avril 2024 à 00:00:00    1 réglisse 7+5 1 amande 7+5 
lundi 8 avril 2024 à 00:00:00    2 cacao 13+6 
mardi 9 avril 2024 à 00:00:00    1 café 7+5 1 chocolat 7+5 
jeudi 11 avril 2024 à 00:00:00    1 vanille 8+3 1 praline 8+0 
vendredi 12 avril 2024 à 00:00:00    1 pêche 8+0 1 prune 11+2 1 figue 7+0 
lundi 15 avril 2024 à 00:00:00    1 orange 8+2 
mardi 16 avril 2024 à 00:00:00    1 zeste de lune 8+3 1 fadoli 9+1 
jeudi 18 avril 2024 à 00:00:00    1 gingembre 8+3 1 cannelle 9+1 
vendredi 19 avril 2024 à 00:00:00    1 poire 6+3 1 fraise 6+3 1 cerise 4+4 
lundi 22 avril 2024 à 00:00:00    1 thym 7+5 1 amande 8+4 
mardi 23 avril 2024 à 00:00:00    1 caramel 10+0 1 chocolat 9+0 
jeudi 25 avril 2024 à 00:00:00    1 vanille 7+5 1 thym 9+1 
vendredi 26 avril 2024 à 00:00:00    1 citron 
lundi 29 avril 2024 à 00:00:00    1 pêche 8+0 1 figue 6+3 1 myrtille 7+3 
mercredi 1 mai 2024 à 00:00:00    1 café 9+0
1 praline 8+0 
jeudi 2 mai 2024 à 00:00:00    1 malaga 7+6 1 chocolat 8+ 
vendredi 3 mai 2024 à 00:00:00    1 vanille xxx 1 fadoli yyyy 
lundi 6 mai 2024 à 00:00:00    1 poire 6+3 1 cerise 6+0 1 prune 8+0 
mercredi 8 mai 2024 à 00:00:00    1 réglisse 9+0 1 fadoli 8+3 
jeudi 9 mai 2024 à 00:00:00    1 vanille 7+5 1 gingembre 8+3 1 chocolat 8+3 
vendredi 10 mai 2024 à 00:00:00    1 vanille 7+5
1 café 8+3
1 amande 10+0 
mardi 14 mai 2024 à 00:00:00    1 pêche 8+0 1 Cerise 5+3 1 figue 6+2 
lundi 13 mai 2024 à 00:00:00    1 abricot 7+4 1 fraise 6+4 1 myrtille 7+3 
vendredi 17 mai 2024 à 00:00:00    1 réglisse 9+0 1 praline 7+2 
jeudi 16 mai 2024 à 00:00:00    1 gingembre 9+0 1 chocolat 9+0 
lundi 20 mai 2024 à 00:00:00    1 vanille 7+5
1 fadoli 8+3 
mardi 21 mai 2024 à 00:00:00    1 fraise 6+3
1 poire 6+2
1 citron 7+2 
jeudi 23 mai 2024 à 00:00:00    1 vanille 7+5 1 cannelle 7+4 1 amande 8+3 
lundi 27 mai 2024 à 00:00:00    1 caramel 8+3 2 praline 13+6 
mercredi 29 mai 2024 à 00:00:00    1 vanille 8+3 1 caramel 8+3 1 amande 8+3 
vendredi 24 mai 2024 à 00:00:00    1 cardamome 7+5 1 café 9+1 1 chocolat 8+3 
vendredi 31 mai 2024 à 00:00:00    Pulpe de cerise 6*4,25 + 1,6 
jeudi 30 mai 2024 à 00:00:00    1 pêche 7+1 1 abricot 8+1 1 orange 5+5 1 myrtille 9+0 
mardi 4 juin 2024 à 00:00:00    1 vanille 7+5 1 amande 10+0 1 chocolat 8+3 
lundi 3 juin 2024 à 00:00:00    2 cacao 13+6 
jeudi 6 juin 2024 à 00:00:00    1 gingembre 8+3 1 malaga 10+0 1 fadoli 8+3 
vendredi 7 juin 2024 à 00:00:00    1 poire 6+2 1 cerise 6+0 1 prune 8+2 1 figue 8+5 
lundi 10 juin 2024 à 00:00:00    1 fraise 8+1 1 pêche 7+1 1 poire 6+2 1 citron 7+4 
mardi 11 juin 2024 à 00:00:00    1 vanille 7+5
1 gingembre 8+3
1 fadoli 8+3 
mercredi 26 juin 2024 à 08:15:00    Contrôle balance - Sud Pesage 
jeudi 13 juin 2024 à 00:00:00    1 café 8+3 1 caramel 8+3 1 chocolat 8+3 
vendredi 14 juin 2024 à 00:00:00    1 myrtille 7+3
1 cerise 6+0
1 OCB 10+5 
lundi 17 juin 2024 à 00:00:00    2 praline 14+4 1 fadoli 8+3 
mardi 18 juin 2024 à 00:00:00    1 vanille 7+5 1 gingembre 8+3  fadoli 8+3 
jeudi 20 juin 2024 à 00:00:00    1 café 8+3 1 caramel 8+3 1 chocolat 8+3 
set lecal to display dialog "Entrer le nom du calendrier :" default answer "Personnel"
set lecal to text returned of result
set ladate to display dialog "Entrer la date de début :" default answer "JJ/MM/AAAA"
set ladate to text returned of result
set lejour to date ladate
set nbjour to display dialog "Entrer le nombre de jours :" default answer "1"
set nbjour to text returned of result
set fin to lejour + (nbjour * days)
set lefich to ""
tell application "Calendar"
    tell calendar lecal
        
        set theEventList to (every event whose (start date > lejour and end date < fin))
        
        set nbevent to count of theEventList
        repeat with j from 1 to nbevent
            set a to summary of item j of theEventList
            set c to start date of item j of theEventList
            
            if c is not "" then
                set lefich to lefich & c & tab & a & " " & return
            end if
        end repeat
    end tell
end tell
tell application "Finder"
    set lelog to open for access ((path to desktop folder as text) & "les evenements.txt") as text with write permission
    set eof lelog to 0
    write lefich to lelog starting at eof
    close access lelog
end tell
set vartoto to lefich
set lesparfums to {"caramel", "fraise", "myrtille", "chocolat", "pêche", "gingembre", "praline", "malaga", "fadoli", "citron", "cerise", "abricot", "poire", "réglisse", "amande", "cacao", "café", "prune", "figue", "orange", "zeste de lune", "cannelle", "thym", "cardamome", "pulpe de cerise"}
set nbparfums to count of lesparfums
set quantite to ""
repeat with nb from 1 to nbparfums
    set cherche to item nb of lesparfums
    set resultat to cherche & " = "
    set tourne to 0
    set bac to 0
    set litre to 0
    set AppleScript's text item delimiters to cherche
    
    set nb to count text item of vartoto
    
    if nb > 1 then
        repeat with i from 2 to nb
            set trouve to text item i of vartoto
            set devant to text item (i - 1) of vartoto
            
            set nbdose to text -3 thru -1 of devant
            set AppleScript's text item delimiters to " "
            
            set ajout to text item 2 of trouve
            
            
            if "*" is in ajout then
                if nbdose is not number then
                    set avant to text -8 thru -1 of devant
                    if ":" is in avant then
                        set lafin to first paragraph of trouve
                        set AppleScript's text item delimiters to "*"
                        set nbbac to text item 1 of lafin
                        set lepoid to text item 2 of lafin
                        set quantite to quantite & cherche & " " & nbbac & " bacs de " & lepoid & " kg" & return
                        
                    end if
                end if
            else
                
                set tourne to tourne + 1
                set AppleScript's text item delimiters to "+"
                set bac to bac + (nbdose * (text item 1 of ajout))
                set litre to litre + (nbdose * (text item 2 of ajout))
            end if
            
            set AppleScript's text item delimiters to cherche
        end repeat
        if bac is not 0 then
            set quantite to quantite & cherche & "  " & tourne & " tournées " & bac & " bacs " & litre & " litres" & return
        end if
    end if
    
end repeat
tell application "Finder"
    set lelog to open for access ((path to desktop folder as text) & "Quantites.txt") as text with write permission
    set eof lelog to 0
    write quantite to lelog starting at eof
    close access lelog
end tell
tell application "Finder"
    activate
    (display dialog ("waouou ... Ca y est c'est fait !") buttons {"Salut !"})
end tell
	set lesparfums to {"abricot", "amande", "cacao", "café", "cannelle", "caramel", "cardamome", "cerise", "chocolat", "citron", "fadoli", "figue", "fraise", "gingembre", "malaga", "myrtille", "orange", "pêche", "poire", "praline", "prune", "pulpe de cerise", "réglisse", "thym", "zeste de lune"}
set lecal to display dialog "Entrer le nom du calendrier :" default answer "Personnel"
set lecal to text returned of result
set ladate to display dialog "Entrer la date de début :" default answer "JJ/MM/AAAA"
set ladate to text returned of result
set lejour to date ladate
set nbjour to display dialog "Entrer le nombre de jours :" default answer "1"
set nbjour to text returned of result
set fin to lejour + (nbjour * days)
set lefich to ""
tell application "Calendar"
    tell calendar lecal
       
        set theEventList to (every event whose (start date > lejour and end date < fin))
       
        set nbevent to count of theEventList
        repeat with j from 1 to nbevent
            set a to summary of item j of theEventList
            set c to start date of item j of theEventList
            set ladate to c as string
           
            --enleve blanc fin
            repeat
                set letest to last character of a
                if letest = " " then
                    set a to text items 1 thru -2 of a as string
                else
                    exit repeat
                end if
            end repeat
            --enleve blanc debut
            repeat
                set letest to first character of a
                if letest = " " then
                    set a to text items 2 thru -1 of a as string
                else
                    exit repeat
                end if
            end repeat
            --enleve blanc milieu
            set i to 1
            repeat
                set letest to character i of a
                if letest = " " then
                    set suivant to character (i + 1) of a
                    if suivant = " " then
                        set debnewa to (text 1 thru i of a) as string
                        set finnewa to (text (i + 2) thru -1 of a) as string
                        set a to debnewa & finnewa
                        set nb to nb - 1
                        set i to i - 1
                    end if
                end if
                set i to i + 1
                set nb to count character of a
                if i = nb then exit repeat
            end repeat
           
            --verifie si parfum existe
            set AppleScript's text item delimiters to " "
            set nb to count text item of a
           
            set nom to ""
            repeat with i from 1 to nb
                set b to text item i of a
                set test to ASCII number (character 1 of b)
                if test < 65 then
                    if nom is not "" then
                        if nom is not in lesparfums then
                           
                            tell application "Finder"
                                set lelog to open for access ((path to desktop folder as text) & "les erreurs.txt") as text with write permission
                                write ladate & " " & a & " le parfum : " & nom & " n'existe pas ! " & return to lelog starting at eof
                                close access lelog
                            end tell
                           
                        end if
                        set nom to ""
                    end if
                else
                    if nom is not "" then set nom to nom & " "
                    set nom to nom & text item i of a
                end if
            end repeat
           
           
            --prepare fichier evenements
            if c is not "" then
                set lefich to lefich & c & tab & a & " " & return
            end if
        end repeat
    end tell
end tell
--crée fichier evenements
tell application "Finder"
    set lelog to open for access ((path to desktop folder as text) & "les evenements.txt") as text with write permission
    set eof lelog to 0
    write lefich to lelog starting at eof
    close access lelog
end tell
--ajout quantite par parfum
set vartoto to lefich
set nbparfums to count of lesparfums
set quantite to ""
repeat with nb from 1 to nbparfums
    set cherche to item nb of lesparfums
    set resultat to cherche & " = "
    set tourne to 0
    set bac to 0
    set litre to 0
    set AppleScript's text item delimiters to cherche
   
    set nb to count text item of vartoto
   
    if nb > 1 then
        repeat with i from 2 to nb
            set trouve to text item i of vartoto
            set devant to text item (i - 1) of vartoto
           
            set nbdose to text -3 thru -1 of devant
            set AppleScript's text item delimiters to " "
           
            set ajout to text item 2 of trouve
           
            --traite les intermediaires (pulpe) sans cumuler les quantitiés
            if "*" is in ajout then
                if nbdose is not number then
                    set avant to text -8 thru -1 of devant
                    if ":" is in avant then
                        set lafin to first paragraph of trouve
                        set AppleScript's text item delimiters to "*"
                        set nbbac to text item 1 of lafin
                        set lepoid to text item 2 of lafin
                        set quantite to quantite & cherche & " " & nbbac & " bacs de " & lepoid & " kg" & return
                       
                    end if
                end if
            else
               
                set tourne to tourne + 1
                set AppleScript's text item delimiters to "+"
                set bac to bac + (nbdose * (text item 1 of ajout))
                set litre to litre + (nbdose * (text item 2 of ajout))
            end if
           
            set AppleScript's text item delimiters to cherche
        end repeat
        if bac is not 0 then
            set quantite to quantite & cherche & "  " & tourne & " tournées " & bac & " bacs " & litre & " litres" & return
        end if
    end if
   
end repeat
tell application "Finder"
    set lelog to open for access ((path to desktop folder as text) & "Quantites.txt") as text with write permission
    set eof lelog to 0
    write quantite to lelog starting at eof
    close access lelog
end tell
tell application "Finder"
    activate
    (display dialog ("waouou ... Ca y est c'est fait !") buttons {"Salut !"})
end tell
	set lesparfums to {"abricot", "amande", "cacao", "café", "cannelle", "caramel", "cardamome", "cerise", "chocolat", "citron", "fadoli", "figue", "fraise", "gingembre", "malaga", "myrtille", "orange", "pêche", "poire", "praline", "prune", "pulpe de cerise", "réglisse", "thym", "zeste de lune"}
set lecal to display dialog "Entrer le nom du calendrier :" default answer "Personnel"
set lecal to text returned of result
set ladate to display dialog "Entrer la date de début :" default answer "JJ/MM/AAAA"
set ladate to text returned of result
set lejour to date ladate
set nbjour to display dialog "Entrer le nombre de jours :" default answer "1"
set nbjour to text returned of result
set fin to lejour + (nbjour * days)
set lefich to ""
tell application "Calendar"
    tell calendar lecal
        
        set theEventList to (every event whose (start date > lejour and end date < fin))
        
        set nbevent to count of theEventList
        repeat with j from 1 to nbevent
            set a to summary of item j of theEventList
            set c to start date of item j of theEventList
            set ladate to c as string
            
            --enleve blanc fin
            repeat
                set letest to last character of a
                if letest = " " then
                    set a to text items 1 thru -2 of a as string
                else
                    exit repeat
                end if
            end repeat
            --enleve blanc debut
            repeat
                set letest to first character of a
                if letest = " " then
                    set a to text items 2 thru -1 of a as string
                else
                    exit repeat
                end if
            end repeat
            --enleve double blanc milieu et blanc devant +
            set i to 1
            repeat
                set letest to character i of a
                if letest = " " then
                    set suivant to character (i + 1) of a
                    if suivant = " " or suivant = "+" then
                        set debnewa to (text 1 thru (i - 1) of a) as string
                        set finnewa to (text (i + 1) thru -1 of a) as string
                        set a to debnewa & finnewa
                        set nb to nb - 1
                        set i to i - 1
                    end if
                    
                end if
                set i to i + 1
                set nb to count character of a
                if i = nb then exit repeat
            end repeat
            --enleve les blancs derriere les +
            set i to 1
            repeat
                set letest to character i of a
                if letest = "+" then
                    set suivant to character (i + 1) of a
                    if suivant = " " then
                        set debnewa to (text 1 thru i of a) as string
                        set finnewa to (text (i + 2) thru -1 of a) as string
                        set a to debnewa & finnewa
                        set nb to nb - 1
                        set i to i - 1
                    end if
                    
                end if
                set i to i + 1
                set nb to count character of a
                if i = nb then exit repeat
            end repeat
            
            
            
            --verifie si parfum existe
            set AppleScript's text item delimiters to " "
            set nb to count text item of a
            
            set nom to ""
            repeat with i from 1 to nb
                set b to text item i of a
                set test to ASCII number (character 1 of b)
                if test < 65 then
                    if nom is not "" then
                        if nom is not in lesparfums then
                            
                            tell application "Finder"
                                set lelog to open for access ((path to desktop folder as text) & "les erreurs.txt") as text with write permission
                                write ladate & " " & a & " le parfum : " & nom & " n'existe pas ! " & return to lelog starting at eof
                                close access lelog
                            end tell
                            
                        end if
                        set nom to ""
                    end if
                else
                    if nom is not "" then set nom to nom & " "
                    set nom to nom & text item i of a
                end if
            end repeat
            
            
            --prepare fichier evenements
            if c is not "" then
                set lefich to lefich & c & tab & a & " " & return
            end if
        end repeat
    end tell
end tell
--crée fichier evenements
tell application "Finder"
    set lelog to open for access ((path to desktop folder as text) & "les evenements.txt") as text with write permission
    set eof lelog to 0
    write lefich to lelog starting at eof
    close access lelog
end tell
--ajout quantite par parfum
set vartoto to lefich
set nbparfums to count of lesparfums
set quantite to ""
repeat with nb from 1 to nbparfums
    set cherche to item nb of lesparfums
    set resultat to cherche & " = "
    set tourne to 0
    set bac to 0
    set litre to 0
    set AppleScript's text item delimiters to cherche
    
    set nb to count text item of vartoto
    
    if nb > 1 then
        repeat with i from 2 to nb
            set trouve to text item i of vartoto
            set devant to text item (i - 1) of vartoto
            
            set nbdose to text -3 thru -1 of devant
            set AppleScript's text item delimiters to " "
            
            set ajout to text item 2 of trouve
            
            --traite les intermediaires (pulpe) sans cumuler les quantitiés
            if "*" is in ajout then
                if nbdose is not number then
                    set avant to text -8 thru -1 of devant
                    if ":" is in avant then
                        set lafin to first paragraph of trouve
                        set AppleScript's text item delimiters to "*"
                        set nbbac to text item 1 of lafin
                        set lepoid to text item 2 of lafin
                        set quantite to quantite & cherche & " " & nbbac & " bacs de " & lepoid & " kg" & return
                        
                    end if
                end if
            else
                
                set tourne to tourne + 1
                set AppleScript's text item delimiters to "+"
                set bac to bac + (nbdose * (text item 1 of ajout))
                set litre to litre + (nbdose * (text item 2 of ajout))
            end if
            
            set AppleScript's text item delimiters to cherche
        end repeat
        if bac is not 0 then
            set quantite to quantite & cherche & "  " & tourne & " tournées " & bac & " bacs " & litre & " litres" & return
        end if
    end if
    
end repeat
tell application "Finder"
    set lelog to open for access ((path to desktop folder as text) & "Quantites.txt") as text with write permission
    set eof lelog to 0
    write quantite to lelog starting at eof
    close access lelog
end tell
tell application "Finder"
    activate
    (display dialog ("waouou ... Ca y est c'est fait !") buttons {"Salut !"})
end tell
	Oui pas de problème.Si la quantité est composé de 2 chiffres, est-ce que ce sera reconnu par votre algorithme ?
set lesparfums to {"abricot", "amande", "cacao", "café", "cannelle", "caramel", "cardamome", "cerise", "chocolat", "citron", "fadoli", "figue", "fraise", "gingembre", "malaga", "myrtille", "orange", "pêche", "poire", "praline", "prune", "pulpe de cerise", "réglisse", "thym", "zeste de lune"}
set lecal to display dialog "Entrer le nom du calendrier :" default answer "Personnel"
set lecal to text returned of result
set ladate to display dialog "Entrer la date de début :" default answer "JJ/MM/AAAA"
set ladate to text returned of result
set lejour to date ladate
set nbjour to display dialog "Entrer le nombre de jours :" default answer "1"
set nbjour to text returned of result
set fin to lejour + (nbjour * days)
set lefich to ""
tell application "Calendar"
    tell calendar lecal
     
        set theEventList to (every event whose (start date > lejour and end date < fin))
     
        set nbevent to count of theEventList
        repeat with j from 1 to nbevent
            set a to summary of item j of theEventList
            set c to start date of item j of theEventList
            set ladate to c as string
         
            --enleve blanc fin
            repeat
                set letest to last character of a
                if letest = " " then
                    set a to text items 1 thru -2 of a as string
                else
                    exit repeat
                end if
            end repeat
            --enleve blanc debut
            repeat
                set letest to first character of a
                if letest = " " then
                    set a to text items 2 thru -1 of a as string
                else
                    exit repeat
                end if
            end repeat
            --enleve double blanc milieu et blanc devant +
            set i to 1
            repeat
                set letest to character i of a
                if letest = " " then
                    set suivant to character (i + 1) of a
                    if suivant = " " or suivant = "+" then
                        set debnewa to (text 1 thru (i - 1) of a) as string
                        set finnewa to (text (i + 1) thru -1 of a) as string
                        set a to debnewa & finnewa
                        set nb to nb - 1
                        set i to i - 1
                    end if
                 
                end if
                set i to i + 1
                set nb to count character of a
                if i = nb then exit repeat
            end repeat
            --enleve les blancs derriere les +
            set i to 1
            repeat
                set letest to character i of a
                if letest = "+" then
                    set suivant to character (i + 1) of a
                    if suivant = " " then
                        set debnewa to (text 1 thru i of a) as string
                        set finnewa to (text (i + 2) thru -1 of a) as string
                        set a to debnewa & finnewa
                        set nb to nb - 1
                        set i to i - 1
                    end if
                 
                end if
                set i to i + 1
                set nb to count character of a
                if i = nb then exit repeat
            end repeat
         
         
         
            --verifie si parfum existe
            set AppleScript's text item delimiters to " "
            set nb to count text item of a
         
            set nom to ""
            repeat with i from 1 to nb
                set b to text item i of a
                set test to ASCII number (character 1 of b)
                if test < 65 then
                    if nom is not "" then
                        if nom is not in lesparfums then
                         
                            tell application "Finder"
                                set lelog to open for access ((path to desktop folder as text) & "les erreurs.txt") as text with write permission
                                write ladate & " " & a & " le parfum : " & nom & " n'existe pas ! " & return to lelog starting at eof
                                close access lelog
                            end tell
                         
                        end if
                        set nom to ""
                    end if
                else
                    if nom is not "" then set nom to nom & " "
                    set nom to nom & text item i of a
                end if
            end repeat
         
         
            --prepare fichier evenements
            if c is not "" then
                set lefich to lefich & c & tab & a & " " & return
            end if
        end repeat
    end tell
end tell
--crée fichier evenements
tell application "Finder"
    set lelog to open for access ((path to desktop folder as text) & "les evenements.txt") as text with write permission
    set eof lelog to 0
    write lefich to lelog starting at eof
    close access lelog
end tell
--ajout quantite par parfum
set vartoto to lefich
set nbparfums to count of lesparfums
set quantite to ""
repeat with nb from 1 to nbparfums
    set cherche to item nb of lesparfums
    set resultat to cherche & " = "
    set tourne to 0
    set bac to 0
    set litre to 0
    set AppleScript's text item delimiters to cherche
 
    set nb to count text item of vartoto
    try
        if nb > 1 then
            repeat with i from 2 to nb
                set trouve to text item i of vartoto
                set devant to text item (i - 1) of vartoto
             
                set nbdose to text -3 thru -1 of devant
                set AppleScript's text item delimiters to " "
             
                set ajout to text item 2 of trouve
             
                --traite les intermediaires (pulpe) sans cumuler les quantitiés
                if "*" is in ajout then
                    if nbdose is not number then
                        set avant to text -8 thru -1 of devant
                        if ":" is in avant then
                            set lafin to first paragraph of trouve
                            set AppleScript's text item delimiters to "*"
                            set nbbac to text item 1 of lafin
                            set lepoid to text item 2 of lafin
                            set quantite to quantite & cherche & " " & nbbac & " bacs de " & lepoid & " kg" & return
                         
                        end if
                    end if
                else
                 
                    set tourne to tourne + 1
                    set AppleScript's text item delimiters to "+"
                    set bac to bac + (nbdose * (text item 1 of ajout))
                    set litre to litre + (nbdose * (text item 2 of ajout))
                end if
             
                set AppleScript's text item delimiters to cherche
            end repeat
            if bac is not 0 then
                set quantite to quantite & cherche & "  " & tourne & " tournées " & bac & " bacs " & litre & " litres" & return
            end if
        end if
    on error
        set lelog to open for access ((path to desktop folder as text) & "Erreur traitement.txt") as text with write permission
        write "ERREUR ! Le parfum : " & cherche & " le " & i - 1 & " trouvé dans les evenements.txt" & return to lelog starting at eof
        close access lelog
    end try
 
end repeat
tell application "Finder"
    set lelog to open for access ((path to desktop folder as text) & "Quantites.txt") as text with write permission
    set eof lelog to 0
    write quantite to lelog starting at eof
    close access lelog
end tell
tell application "Finder"
    activate
    (display dialog ("waouou ... Ca y est c'est fait !") buttons {"Salut !"})
end tell