Batch convert PowerPoint files to PDF using Automator on macOS
-
August 30, 2024: Pull Request Merged
- A PR#6 updating the convert-ppt-to-pdf.applescript has been merged. This update includes:
- Improved compatibility with the new Mac OS.
- Use of POSIX file paths to get appropriate new file paths.
- Additional logging functionality for easier troubleshooting (commented out by default).
- A PR#6 updating the convert-ppt-to-pdf.applescript has been merged. This update includes:
-
August 30, 2024: README and Script Updated
- We have updated both the README and the script in response to the macOS Sonoma compatibility issue (see Issue#5). The changes include:
- A new script that addresses the alias handling problem in macOS Sonoma.
- We have updated both the README and the script in response to the macOS Sonoma compatibility issue (see Issue#5). The changes include:
- Launch the Automator
- Choose a type as Quick Action for your documents
- Find Actions, 'Run AppleScript'
- Type the AppleScript
- Set the input setting
- Type the script
- Save the Quick Action
Open the Automator application on your Mac.
When creating a new document, select 'Quick Action' as the type for your workflow.
In the library, search for and add the 'Run AppleScript' action to your workflow.
Set the workflow to receive input from 'documents' in 'Finder'.
Copy and paste the following AppleScript code (link) into the 'Run AppleScript' action:
on run {input, parameters}
set theOutput to {}
-- set logFile to (POSIX path of (path to desktop folder)) & "conversion_log.txt" -- for logging
-- do shell script "echo 'Starting conversion...' > " & logFile -- for logging
tell application "Microsoft PowerPoint" -- work on version 15.15 or newer
launch
repeat with i in input
set t to i as string
-- do shell script "echo 'Processing: " & t & "' >> " & logFile -- for logging
if t ends with ".ppt" or t ends with ".pptx" then
set pdfPath to my makeNewPath(i)
-- do shell script "echo 'Saving to: " & pdfPath & "' >> " & logFile -- for logging
try
open i
set activePres to active presentation
-- Export the active presentation to PDF
save activePres in (POSIX file pdfPath) as save as PDF
close active presentation saving no
set end of theOutput to pdfPath
-- Log the path to the console
-- do shell script "echo 'Saved PDF to: " & pdfPath & "' >> " & logFile -- for logging
on error errMsg
-- do shell script "echo 'Error: " & errMsg & "' >> " & logFile -- for logging
end try
end if
end repeat
end tell
tell application "Microsoft PowerPoint" -- work on version 15.15 or newer
quit
end tell
-- do shell script "echo 'Conversion completed.' >> " & logFile -- for logging
return theOutput
end run
on makeNewPath(f)
set t to f as string
if t ends with ".pptx" then
return (POSIX path of (text 1 thru -6 of t)) & ".pdf"
else
return (POSIX path of (text 1 thru -5 of t)) & ".pdf"
end if
end makeNewPath
Give your workflow a name (e.g., "Convert PPT to PDF") and save it.
- In Finder, select the PowerPoint files you want to convert.
- Right-click to open the context menu.
- Navigate to Quick Actions > "Convert PPT to PDF".
- Wait for the conversion process to complete.