Batch-convert .doc to .docx?

I am running Word 2016 with macOS 10.14.3.

What is the best way to batch-convert MS Word .doc files to the .docx format?

Thank you,

David

Hi David,

I needed to do the same recently and found an Applescript that works with Word 2011 and stuck it inside an Automator Workflow and saved it as an app which you can drop Word files on to.

The script came from here: https://www.reddit.com/r/applehelp/comments/3qd9az/applescript_to_batch_convert_doc_to_docx/

You can download a working copy of the script, workflow and app from here: https://www.dropbox.com/s/32g4s78ilb646i7/doc%20to%20docx%20converter.zip?dl=0

Do let me know if it works for you!

Cheers,

Dave

Thank you for the tip – I really appreciate your help.

Sorry for not understanding more about this but when I dropped a file onto the app icon I got this message:

“The action ‘Run AppleScript’ encountered an error: ‘The operation couldn’t be completed. (com.apple.Automator error -212.)’”

Was I doing it wrong?

By the way, the file Kind is “Microsoft Word 97-2004 document (.doc).”

David

Hi David,

A bit of running around on Google tells me this is a Mojave / 10.14 issue. As I created the app in a version of the system before that you will need to recreate it.

To do so:
open the doc to docx.workflow (Double click will open it in Automator).
Then hold down the option key and go into the File menu and choose ‘Save As
’ (it will show Save if you do not hold the correct key down).
In the dialog that comes up change the destination to your desktop, for example, or someplace where the copy you downloaded from me is not. Before clicking ok you also need to change the File Format to ‘Application’. In my view that is at the bottom of the dialog box.

Once you click ok it will create a new version which is compatible with Mojave. On first launch it should ask for permission to do things on your behalf, you need to allow it. After that it should work as expected!

I am not running Mojave yet on my Mac so I am doing a bit of guesswork :wink:

Cheers,

Dave

I followed your instructions but unfortunately whether I double-click the app or drop a Word doc onto it, it never opens and instead I get the same error message as before.

Does it matter that I am using Word 2016?

David

Progress update:

I copied and pasted the script you sent me into the workflow, then saved it as a new application.

When I dropped a file onto the application icon I got a message asking to give Automator access to Finder and Microsoft Word, which I did.

Now I no longer get an error message but nothing seems to happen.

The application icon and Word doc flash once each, but I can’t see a new .docx file and the original one seems to be unchanged – Command-I says it is still a Microsoft Word 97 - 2004 document (.doc).

David

Further progress:

The filenames of the Word docs in question do not have a .doc extension. (That was the way Word had saved them.)

If I add .doc, the conversion works.

David

After getting an error saying the operation couldn’t be completed (but without any error code), I copied and pasted the text that starts with the line “property theList : {“doc”}” into Automator and saved as a new app in a new location. I still got the error. Did I misunderstand what you said you did to get it to work? This is on El Capitan 10.11.6, and I made sure to use a Word document that had the .doc extension. Thanks for any help.

Yes – it works fine now with 10.14.3.

What I did was copy the original script, open the workflow, copy the script into the workflow and save as a new application, then used A Better File Rename to add .doc to the files.

I also later converted the application into a folder (via File > Convert to), which also works.

Sorry not to be of more help but my knowledge of Automator is extremely rudimentary.

David

What was the original script? Was “property theList : {“doc”}” the first line?

What is workflow? Is that the right window pane in Automator, with Run AppleScript at the top?

Sorry to be so annoyingly literal, and I’m sure that your knowledge of Automator is vastly superior to mine. I copied that the text that started with “property theList : {“doc”}” into the right pane of Automator, saved as a new app, and still failed. If I’ve done what you did, I’ll give up. If you did something different, please explain (in excruciating detail). Thanks for bearing with me.

I have only used Automator once or twice before and know very little about it.

The script I used is the one in the file “doc to docx.scpt”, which I got from the second link in David Rostenne’s message above.

I copied that script (from “property theList : {“doc”}” to “end run”, opened the “doc to docx.workflow” file, highlighted the script that was in the workflow window and pasted the script I had just copied.

Then I held down the Option key, clicked File > Save As and saved the workflow as a new application, as David Rostenne had suggested.

After adding .doc to a Word doc file name, dropping the file on the Automator doc to docx.app converts it to .docx format.

I later converted the app to a Folder Action, which works better for my purposes. (Word .doc files that are placed into the folder are converted to .docx.)

David

The two scripts may be identical – I didn’t take time to compare them – so this may be an unnecessary step.

I was just trying anything that might make a difference.

David

I just had time to compare the two scripts and see there is a difference in line 25:

Script in “doc to docx.workflow”:
save as theActiveDoc file format format document file name theFilename without maintain compatibility

Script in “doc to docx.scpt”:
save as theActiveDoc file format format document file name theFilename without «class 5249»

I used the script in the .scpt file to replace the one in the workflow file.

David

And I appreciate (and need) that.

That made a change. Now it I don’t get the error message.

Unfortunately, the output file is empty. It has the input file’s name with the extension changed from doc to docx, but when I open it, Word shows an empty document.

I did get the message asking to give something (I assume Automator) access to the desktop, but there was only one request for permission. My guess is that the lack of that second permission request is what led to the empty file, but that’s just a guess.

Can you help me further?

Probably it’s nothing, but the doc file on the desktop just has the file name below the icon. The docx file has the file name and the size (11 KB), and quick view has a scroll bar, apparently indicating that there is something in the file. (Opening it in TextWrangler allows me to see a lot of xml code.)

Thanks for any continuing help.

When I look at doc to docx.scpt by clicking once and pressing the space bar, it’s mostly incomprehensible, but there are references to MacHD:Applications:Microsoft Office 2011:Microsoft Word.app&Microsoft Word.app and MacHD5Applications/Microsoft Office 2011/Microsoft Word.app/. My internal (and boot) disk is not named MacHD and I do not have a Microsoft Office 2011 folder (I have Office 2015, which is now called Office 2016). Could any of these discrepancies be causing problems?

When I open doc to docx.scpt in Script Editor, I do not see these references; application “Microsoft Word” does appear, but I don’t see any way to change the hard disk name or the application location.

Unfortunately this is beyond my knowledge.

I hope maybe someone else with more expertise can chime in?

David

I think you are right about this.

I would try redoing the process from the beginning to see if you get a different result.

David

I think David is correct
 rebuild the app from scratch and see if it works the second time around.

Cheers,

Dave

Thanks, David. I opened the script in Script Editor, copied the non-comment text, then opened Automator and chose Workflow for type of document. I scrolled down and double-clicked Run AppleScript. I replaced all the default text with the text that I had copied from doc to docx.scpt. Holding down the option key, I chose Save As
 and saved the output as an app (on the Desktop, if it matters). I dropped a doc file on it, and after a moment, a docx file with the same name appeared on the Desktop. I was not asked to grant anything permission, and the docx file appeared to be blank, even though its size is 11 KB.

Not knowing what else to do, I followed exactly the same steps, documenting them in this post as I went. There was one difference. This time, it worked! (Actually, two differences. This time, the output file was 12 KB.)

I tried it on a few more files, and it appears to work. I do need to grant Word access to the folder containing the file to be processed. I tried to grant Word access to my Documents folder, and it worked on a file in a subfolder, but I needed to grant access for the next file, which was in a different subfolder.

Thank you, both Davids.

How did you do this, please?

I tried using File >Convert to, and I was asked to identify a folder (which I created and named doc to docx), but it does not seem to have any action associated with it. Would you provide step by step instructions, please?