Batch Convert iWork to MS Office

Discussion in 'Mac Apps and Mac App Store' started by jblagden, Jan 26, 2014.

  1. jblagden macrumors 65816

    jblagden

    Joined:
    Aug 16, 2013
    #1
    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.
     
  2. Weaselboy Moderator

    Weaselboy

    Staff Member

    Joined:
    Jan 23, 2005
    Location:
    California
    #2
    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.

    [​IMG]
     
  3. jblagden thread starter macrumors 65816

    jblagden

    Joined:
    Aug 16, 2013
    #3
    I Already Knew That, But Thanks Anyway

    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.
     
  4. Weaselboy Moderator

    Weaselboy

    Staff Member

    Joined:
    Jan 23, 2005
    Location:
    California
    #4
    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. :(
     
  5. jblagden thread starter macrumors 65816

    jblagden

    Joined:
    Aug 16, 2013
    #5
    That's Why I Created This Thread

    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.
     
  6. kryten2 macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #6
    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.
     
  7. Weaselboy Moderator

    Weaselboy

    Staff Member

    Joined:
    Jan 23, 2005
    Location:
    California
    #7
    Nice work kryten2.
     

Share This Page