Ok tu utilises quel script ? celui du message #9 ou celui du message #12
je te met celui du message #12 , le dernier donc, avec la recherche sur les dossiers choisis, sans aller dans leurs sous-dossiers.
dis moi si c'est bon !
Bloc de code:
tell application "Finder"
set resultat to choose folder with prompt "Sélectionner le dossier pour les resultats"
set pdf1 to choose folder with prompt "Sélectionner le premier fichier pour la recherche"
set pdf1 to pdf1 as string
set pdf1 to quoted form of POSIX path of pdf1 as string
set pdf2 to choose folder with prompt "Sélectionner le deuxième dossier pour la recherche"
set pdf2 to pdf2 as string
set pdf2 to quoted form of POSIX path of pdf2 as string
set bureau to POSIX path of (path to desktop folder as text)
set commande to "find " & pdf1 & " -maxdepth 1 -name '*.pdf' > " & bureau & "liste.txt"
do shell script commande
set commande to "find " & pdf2 & " -maxdepth 1 -name '*.pdf' > " & bureau & "liste1.txt"
do shell script commande
set commande to "cat " & bureau & "liste1.txt >> " & bureau & "liste.txt"
do shell script commande
do shell script "rm " & bureau & "liste1.txt"
set laligne to 2
set drapeau to 0
repeat
set liste1 to ""
set liste2 to ""
set nb1 to 0
set nb2 to 0
tell application "Microsoft Excel"
activate
set lefichier to value of range ("a" & laligne)
set materiel to value of range ("b" & laligne)
set largeur to value of range ("d" & laligne)
set hauteur to value of range ("e" & laligne)
set recto to value of range ("i" & laligne)
set QT to value of range ("m" & laligne)
end tell
if lefichier is "" then
exit repeat
end if
set lenom to lefichier & "_" & materiel & "_" & largeur & "_" & hauteur & "_" & recto & "_" & QT & "ex"
--Cherche le fichier
set commande to "grep " & lefichier & " " & bureau & "liste.txt"
try
set liste1 to do shell script commande
on error
set liste1 to ""
end try
set AppleScript's text item delimiters to {return}
set nb1 to count text item of liste1
if nb1 = 0 or nb1 > 1 then
set lelog to open for access ((path to desktop folder as text) & "les erreurs.txt") as text with write permission
write "A la ligne : " & laligne & " dans liste = " & nb1 & "fichier trouvé. " & return to lelog starting at eof
close access lelog
set drapeau to 1
end if
if nb1 = 1 then
set liste to liste1
end if
if drapeau = 0 then
tell application "Finder"
set lechemin to text item 1 of liste
set lechemin to lechemin as string
set resultat to resultat as string
set a to (resultat & materiel)
if not (exists a) then
make new folder at resultat with properties {name:materiel}
end if
set a to quoted form of POSIX path of a
set lechemin to quoted form of POSIX path of lechemin
do shell script "cp " & lechemin & " " & a
set anciennom to resultat & materiel & ":" & lefichier & ".pdf"
set anciennom to quoted form of POSIX path of anciennom
set nouveaunom to resultat & materiel & ":" & lenom & ".pdf"
set nouveaunom to quoted form of POSIX path of nouveaunom
set commande to "mv " & anciennom & " " & nouveaunom
do shell script commande
end tell
end if
set drapeau to 0
set laligne to laligne + 1
end repeat
end tell
tell application "Finder"
do shell script "rm " & bureau & "liste.txt"
activate
display dialog "termine"
end tell