Ah ben refaite "Combiner pdf" alors...Loupé, même en installant Python ça ne fonctionne pas. En revanche, Automator précise bien au début que l'action "Combiner pdf" peut ne pas fonctionner correctement (puisqu'il a été créé avec une version antérieure)...
use scripting additions
use framework "Foundation"
use framework "Quartz" -- required for PDF stuff
property inFolderPosix : ""
property destPosixPath : ""
tell application "Finder"
set chemin to choose folder with prompt "Sélectionnez le dossier contenant les fichiers à traiter"
my inspecter(chemin)
end tell
on inspecter(chemin)
tell application "Finder"
set inFolderPosix to POSIX path of chemin as text
set destPosixPath to POSIX path of chemin & "Combine.pdf" as text
end tell
its combineFilesIn:inFolderPosix savingTo:destPosixPath
tell application "Finder"
set chemin to chemin as alias
set les_dossiers to folders of chemin
repeat with chaque_dossier in les_dossiers
set chaque_dossier to chaque_dossier as alias
my inspecter(chaque_dossier)
end repeat
end tell
end inspecter
tell application "Finder"
activate
(display dialog ("waouou ... Ca y est c'est fait !") buttons {"Salut !"})
end tell
on combineFilesIn:inFolderPosix savingTo:destPosixPath
try
set dirURL to current application's class "NSURL"'s fileURLWithPath:inFolderPosix
set theURLs to current application's NSFileManager's defaultManager()'s contentsOfDirectoryAtURL:dirURL includingPropertiesForKeys:{} options:(current application's NSDirectoryEnumerationSkipsHiddenFiles) |error|:(missing value)
set theDoc to current application's PDFDocument's alloc()'s initWithURL:(theURLs's firstObject())
set oldDocCount to theDoc's pageCount()
repeat with i from 1 to ((theURLs's |count|()) - 1)
set newDoc to (current application's PDFDocument's alloc()'s initWithURL:(theURLs's objectAtIndex:i))
-- loop through, moving pages
set newDocCount to newDoc's pageCount()
repeat with i from 1 to newDocCount
set thePDFPage to (newDoc's pageAtIndex:(i - 1)) -- zero-based indexes
(theDoc's insertPage:thePDFPage atIndex:oldDocCount)
set oldDocCount to oldDocCount + 1
end repeat
end repeat
set outNSURL to current application's class "NSURL"'s fileURLWithPath:destPosixPath
(theDoc's writeToURL:outNSURL)
end try
end combineFilesIn:savingTo:
use scripting additions
use framework "Foundation"
use framework "Quartz" -- required for PDF stuff
property inFolderPosix : ""
property destPosixPath : ""
property doserreur : ""
tell application "Finder"
set chemin to choose folder with prompt "Sélectionnez le dossier contenant les fichiers à traiter"
my inspecter(chemin)
end tell
on inspecter(chemin)
tell application "Finder"
set inFolderPosix to POSIX path of chemin as text
set destPosixPath to POSIX path of chemin & "Combine.pdf" as text
end tell
set doserreur to inFolderPosix
its combineFilesIn:inFolderPosix savingTo:destPosixPath
tell application "Finder"
set chemin to chemin as alias
set les_dossiers to folders of chemin
repeat with chaque_dossier in les_dossiers
set chaque_dossier to chaque_dossier as alias
my inspecter(chaque_dossier)
end repeat
end tell
end inspecter
tell application "Finder"
activate
(display dialog ("waouou ... Ca y est c'est fait !") buttons {"Salut !"})
end tell
on combineFilesIn:inFolderPosix savingTo:destPosixPath
try
set dirURL to current application's class "NSURL"'s fileURLWithPath:inFolderPosix
set theURLs to current application's NSFileManager's defaultManager()'s contentsOfDirectoryAtURL:dirURL includingPropertiesForKeys:{} options:(current application's NSDirectoryEnumerationSkipsHiddenFiles) |error|:(missing value)
set theDoc to current application's PDFDocument's alloc()'s initWithURL:(theURLs's firstObject())
set oldDocCount to theDoc's pageCount()
repeat with i from 1 to ((theURLs's |count|()) - 1)
set newDoc to (current application's PDFDocument's alloc()'s initWithURL:(theURLs's objectAtIndex:i))
-- loop through, moving pages
set newDocCount to newDoc's pageCount()
repeat with i from 1 to newDocCount
set thePDFPage to (newDoc's pageAtIndex:(i - 1)) -- zero-based indexes
(theDoc's insertPage:thePDFPage atIndex:oldDocCount)
set oldDocCount to oldDocCount + 1
end repeat
end repeat
set outNSURL to current application's class "NSURL"'s fileURLWithPath:destPosixPath
(theDoc's writeToURL:outNSURL)
on error
set lelog to open for access ((path to desktop folder as text) & "les erreurs.txt") as text with write permission
write "Le dossier : " & doserreur & " ne sera pas traité !" & return to lelog starting at eof
close access lelog
end try
end combineFilesIn:savingTo: