Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Batch convert Word files to PDFs via Pages' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Batch convert Word files to PDFs via Pages
Authored by: snit on Oct 20, '08 01:09:25PM

I had the need to do this recently... but instead of AppleScript I used Automator. The steps are simple:

1) Get Selected Items
2) Convert Format of Word Documents (select PDF)

I then saved it as an Finder Plug-In. Now whenever I need to do such conversions I just right-click on the set of files to be converted (control click, if you want) and select:

  More > Automator > Convert WORD to PDF

Works like a charm... but I have Word 2008... which comes with Automator actions.



[ Reply to This | # ]
Batch convert Word files to PDFs via Pages
Authored by: jctull on Oct 20, '08 01:45:42PM
Ah, I like this solution.

In case you still want to do this through Pages, I made a version where the pdf is saved in the same location as the original file. Also, I made it quit Pages if Pages was not open when the script is run and leave it open otherwise.

on open filist
if application "Pages" is running then
repeat with lvar in filist
tell application "Finder"
set thename to name of lvar
set thepath to container of lvar
end tell
set x to the offset of "." in thename
set nuname to text 1 thru text item x of thename
tell application "Pages"
activate
set filname to (thepath as text) & nuname & "pdf"
open lvar
save document 1 as "SLDocumentTypePDF" in filname
close every window saving no
end tell
end repeat
else
repeat with lvar in filist
tell application "Finder"
set thename to name of lvar
set thepath to container of lvar
end tell
set x to the offset of "." in thename
set nuname to text 1 thru text item x of thename
tell application "Pages"
activate
set filname to (thepath as text) & nuname & "pdf"
open lvar
save document 1 as "SLDocumentTypePDF" in filname
close every window saving no
end tell
end repeat
tell application "Pages" to quit
end if
end open


[ Reply to This | # ]
Batch convert Word files to PDFs via Pages
Authored by: soopah256 on Jun 16, '10 04:32:35PM

Thanks for the code! It's exactly what I needed.
My files names included a "." in the filename, so I tweaked the code so that it preserves the full filename. (the *.doc extension must be present)

on open filist
if application "Pages" is running then
repeat with lvar in filist
tell application "Finder"
set thename to name of lvar
set thepath to container of lvar
end tell
set x to the offset of ".doc" in thename
set nuname to text 1 thru text item x of thename
tell application "Pages"
activate
set filname to (thepath as text) & nuname & "pdf"
open lvar
save document 1 as "SLDocumentTypePDF" in filname
close every window saving no
end tell
end repeat
else
repeat with lvar in filist
tell application "Finder"
set thename to name of lvar
set thepath to container of lvar
end tell
set x to the offset of ".doc" in thename
set nuname to text 1 thru text item x of thename
tell application "Pages"
activate
set filname to (thepath as text) & nuname & "pdf"
open lvar
save document 1 as "SLDocumentTypePDF" in filname
close every window saving no
end tell
end repeat
tell application "Pages" to quit
end if
end open



[ Reply to This | # ]
Batch convert Word files to PDFs via Pages
Authored by: ejstembler on Jan 12, '09 01:44:53PM

Yes, in Microsoft Word 2008 (for Mac) I found the Automator workflow which converts a batch of Word documents into another format (including PDF).

Look for:

Convert the format of specified Word files\scg.workflow

in

/Users/{Your user name}/Documents/Microsoft User Data/Word Script Menu Items/Sample Automator Workflows/



[ Reply to This | # ]