AppleScript - Export multiple Word documents as PDFs

I was recently asked to review a Book which was shared with me as a series of Word documents. However, I would like them as PDF. I would like to read and annotate them with an iPad and PDF Expert.

AppleScript to the rescue!. The following AppleScript prompts you to select multiple word documents, asks you for a folder to save the PDFs, opens each document in Word and saves it as PDF.

The AppleScript script prompts you to select multiple word documents, asks you for a folder to save the PDFs, opens each document in Word and saves it as PDF.

tell application "Microsoft Word"
set wordDocuments to choose file with prompt "Please select the document to process:" with multiple selections allowed
set exportLocation to choose folder with prompt "Please select where you'd like export the pdfs:"
repeat with a from 1 to number of wordDocuments
	set doc to open item a of wordDocuments
	set theActiveDoc to the active document
	set docName to name of theActiveDoc
	save as theActiveDoc file format format PDF file name ((exportLocation as text) & docName & ".pdf")
	close theActiveDoc
end repeat
quit
end tell

Tags: #automation #pdf #word #applescript
Jul 2021, 21.

 

My next events:
🗓 Apr 04 16:30 JDevSummitIL Getting Started with the Micronaut Framework