Sunday, March 2, 2014

Batch Convert Pages to DOCX or PDF

Here are some programs to batch convert Pages files to .docx or .PDF. This is written in applescript, and saved as an "application", so just drag and drop the files you want to convert onto the application.

Choose your desired program to download:
Convert Batch Pages to Docx_v1 --> deletes .pages file that you are converting
Convert Batch Pages to Docx_v2 --> keeps original .pages file that you are converting

Convert Batch Pages to PDF_v1 --> deletes .pages file that you are converting
Convert Batch Pages to PDF_v2 --> keeps original .pages file that you are converting

The code that these applications (droplets) use is this:

on open theFiles
tell application "Pages"
repeat with aFile in theFiles
open aFile
set sourceFolder to POSIX path of aFile
set newsourceFolder to characters 1 thru -8 of sourceFolder as string
set theFolder to newsourceFolder & ".docx"
export front document to POSIX file theFolder as Word
close front document
end repeat
end tell
tell application "Finder"
repeat with aFile in theFiles
delete aFile
end repeat
end tell
end open

4 comments:

  1. Great Article! Nice work.I would like to suggest one more converter i.e DocuFreezer which i personally use for Batch conversion of pages to Dox or PDF files. The Drag and Drop feature is the best feature of this. The download link is www.docufreezer.com
    Otherwise the collection is great

    ReplyDelete
  2. This worked fast and accurate...except that it truncated the file name by one character consistently. I can live with that! I just thought you might want to know.

    ReplyDelete
    Replies
    1. Change "set newsourceFolder to characters 1 thru -8 of sourceFolder as string" with "set newsourceFolder to characters 1 thru -7 of sourceFolder as string" and will work ok without losing caracters

      Delete