Created
October 15, 2015 19:33
-
-
Save loop/7207134ed7ff7a288ee1 to your computer and use it in GitHub Desktop.
Revisions
-
loop created this gist
Oct 15, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ 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