Hallo,
ich habe im Netz eine kurze und nette Möglichkeit (mit NoeOffice, Libreoffice etc.) gefunden, aus Office-Dateien (Word, Excel oder Powerpoint) PDF's zu generieren.
Aber: Das Script streikt bei Dateinamen, welche Leerzeichen enthalten (z. B. "Meine Datei.doc").
Meine Frage also: Gibt es eine Möglichkeit, das hinzubekommen, ohne alle Dateinamen, die Leerzeichen enthalten, ändern zu müssen?
Herzliche Grüße und FROHE FEIERTAGE!!!
Bernd Kühn
Hier das bisherige Script:
property name_extension : {"doc", "docx", "xls", "xlsx", "ppt", "pptx"}
global fileCnt
on open of finderObjects
set fileCnt to 0
repeat with i in (finderObjects)
if folder of (info for i) is true then
tell application "Finder" to set temp to (entire contents of i)
repeat with j in (temp)
process_files(j)
end repeat
else
process_files(i)
end if
end repeat
display notification "Processed Files: " & fileCnt with title "Word2PDF" subtitle "Processing Complete"
end open
on process_files(fname)
set cmd to "/Applications/NeoOffice.app/Contents/MacOS/soffice "
set cmdArgs to "--headless --convert-to pdf:writer_pdf_Export --outdir "
tell application "Finder"
set nameExt to name extension of fname
set outDir to do shell script "dirname " & POSIX path of (fname as alias)
if name extension of fname is in name_extension then
try
do shell script cmd & cmdArgs & outDir & space & POSIX path of (fname as alias)
set fileCnt to fileCnt + 1
on error errorMessage number errorNumber
display alert "Processing Error: " message "[ " & errorNumber & " ] " & errorMessage
error number -128
end try
end if
end tell
return
end process_files