I spent a long time trying to find a simple way to batch (bulk) convert .pages files to PDFs on a mac. There were a few Applescript examples online, but I couldn’t get anything working with a simple drag and drop compiled app. Perhaps older Applescript versions that were no longer working with High Sierra? I’m not an Applescript expert, but I finally managed it with this script.
As of January 2019 this works with my 10.13.6 Mac (High Sierra) and Pages v7.3
on open theDroppedItems
repeat with theFile in theDroppedItems
tell application "Finder"
set theFilesFolder to (folder of theFile) as text
end tell
tell application "Pages"
set theDoc to open theFile
set theDocName to name of theDoc
set theName to (characters 1 thru -7 of theDocName) as text
export theDoc as PDF to file ((theFilesFolder & theName & ".pdf") as text)
close theDoc
end tell
end repeat
return theDroppedItems
end open
Note: The ‘core’ of this code came from a forum or webpage elsewhere, but I’ve unfortunately lost the link/author and haven’t been able to find it again. So apologies (and thanks) to this Applescript author – I mainly added the containing “open theDroppedItems” bit and a couple of tweaks to sort the syntax. If I find the code again online I’ll add the link here.
For reference, to get this code working – copy and paste it into your Apple “Script Editor” app – then compile it to an App (via export…), then you can drag and drop .pages files to the app to convert pages files.
Note: there may be better error checking code that could be applied e.g. I don’t know what would happen with other file formats. So treat with caution, but it does work. I’m posting for reference, in case this saves someone a couple of hours, but don’t take any responsibility for the core code. 🙂
Works like a charm on my iMac with HighSierra 10.13.6. Thank you very much!