Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jblagden

macrumors 65816
Original poster
Aug 16, 2013
1,162
641
I use iWork for my documents, but I sometimes need to convert a folder of iWork files to Microsoft Office files. It's one thing to convert one iWork document, but it's very tedious when I need to convert multiple documents. I'm hoping to be able to automate this process. By the way, I'm using the latest versions of the iWork applications, which I know have a lot less or no Automator support.
 
I think you could cobble this together with Applescript. I see some sites like this showing Applescripts with the older versions of Pages, that I assume won't work with the new version.

But if you open Applescript editor and look at the Pages functions available, it looks like Applescript support for the export function is still there.

VBQ9DX1.png
 
I Already Knew That, But Thanks Anyway

I think you could cobble this together with Applescript. I see some sites like this showing Applescripts with the older versions of Pages, that I assume won't work with the new version.

But if you open Applescript editor and look at the Pages functions available, it looks like Applescript support for the export function is still there.

VBQ9DX1.png

I already found that much out through some research before posting this thread, but thanks anyway. I was hoping for an already prepared script because I've written a bit in Java, but I've never written in Applescript before. But thanks for the effort. Gold star for effort.
 
But thanks for the effort. Gold star for effort.

Heh... you bet. :D

I think the problem you are going to run up against is the new Pages is so new that any Applescript or Automator pre-existing tools out there are going to be for the older versions. At least that is how it looked to me when I searched a bit. :(
 
That's Why I Created This Thread

Heh... you bet. :D

I think the problem you are going to run up against is the new Pages is so new that any Applescript or Automator pre-existing tools out there are going to be for the older versions. At least that is how it looked to me when I searched a bit. :(

I know about the new version of Pages. That's precisely why I started this thread. I was hoping that someone might have a solution for the new version of Pages.
 
I know about the new version of Pages. That's precisely why I started this thread. I was hoping that someone might have a solution for the new version of Pages.

Here's an example. Make a copy of some folder with Pages documents in to test it with.

Code:
set this_folder to (choose folder with prompt "Pick the folder containing the Pages files to process:" default location path to documents folder) --as string

tell application "Finder"
	set these_files to (every file of this_folder whose kind is "Pages Publication") as alias list
	if not (exists folder "WordDocs" of folder this_folder) then
		set wordDocsDest to (make new folder at this_folder with properties {name:"WordDocs"}) as string
	else
		set wordDocsDest to (this_folder as text) & "WordDocs:"
	end if
end tell

repeat with i from 1 to the count of these_files
	set this_file to (item i of these_files)
	tell application "Pages"
		activate
		set the_document to open this_file
		export the_document to file (wordDocsDest & (the_document's name) & ".docx") as Word
		close the_document
	end tell
end repeat

Note : Tested on Mavericks with Pages v5.0.1. For my test I just created 5 Pages documents from the templates. The resulting Word documents e.g. docx files could be opened in Microsoft Word v14.0.0.
 
For anybody reading this: You could also use my app Docxtor. It lets you convert whole folders of iwork documents to PDF or Microsoft Office and will even reproduce complete folder structures. (Disclaimer: I am the developer of this app!)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.