Last active
November 13, 2021 22:22
-
-
Save patrickleweryharris/32caecd150a5d69cc379540709c2e8dc to your computer and use it in GitHub Desktop.
Revisions
-
patrickleweryharris revised this gist
Nov 13, 2021 . No changes.There are no files selected for viewing
-
patrickleweryharris revised this gist
Aug 19, 2019 . No changes.There are no files selected for viewing
-
patrickleweryharris revised this gist
Aug 19, 2019 . No changes.There are no files selected for viewing
-
patrickleweryharris created this gist
Aug 19, 2019 .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,25 @@ set _document to theFile -- Open a docx document in pages and auto export to PDF tell application "Finder" set _directory to get container of file _document set _documentName to name of _document -- Figure out document name without extension if _documentName ends with ".docx" then ¬ set _documentName to text 1 thru -6 of _documentName set _PDFName to _documentName & ".pdf" set _location to (_directory as string) & _PDFName end tell tell application "Pages" activate open _document with timeout of 1200 seconds -- Export as PDF with _PDFName export front document to file _location as PDF end timeout close front document end tell