I’m trying to batch convert Apple docs to pdf. I’m a teacher and my colleagues all have Windows PCs. From time to time I have to share files with them, so I usually convert them to PDF.
Now this is tedious… Open pages, choose file, export, pdf…
I would like to choose a bunch of files, trigger an Applescript with Keyboard Maestro and convert them.
I’ve found a working script but it works differently:
set theFolder to choose folder with prompt "Select folder with original pages files :" --Do it tell application "Finder" set theNames to name of files of theFolder ¬ whose name extension is "pages" end tell -- How many files to export set item_count to (get count of items in theNames) --Get files and export them repeat with i from 1 to item_count set current_file to item i of theNames -- get a file set lean_file to text 1 thru -7 of current_file & ".pdf" -- change the originalfile (.pages) to a .pdf name set out_file to (theFolder as Unicode text) & (lean_file) -- get the fully qualified output name set in_file to (theFolder as Unicode text) & (current_file) -- get the fully qualified input file name tell application "Pages" set mydoc to open file in_file -- open input file in Pages export mydoc to file out_file as PDF --do the exporting close mydoc saving no -- close the original file without saving end tell end repeat display dialog "done" -- Job done
Instead of letting me choose the files I have to choose a folder and it converts every .pages inside. I would rather choose my files myself, either with KM or by Applescript. Is there a way to change my script to do this?