Solved: Options in automating batch conversion of Word.doc to PDFs

You could run a KM macro in parallel to your Word AppleScript, roughly like this:

  • Set to a periodic trigger of 15s.
  • It reads a unique value, for example the document name / window title of the open Word window, and stores it in a variable.
  • It compares the value to the previously stored value
  • If it’s the same it presses ⌘-Period.

Hey Folks,

An interesting set of utilities that might be worth looking into:

BatchOutput DOC

Automate printing and PDF production from Word.

The link takes you to the BatchOutput Office page, but you can buy the Word, Excel, and PowerPoint utilities separately or as a bundle (with 25% off).

I haven’t tried it, but if I was going to convert thousands of files I certainly would check it out.

-Chris

Great idea, Tom! This is what I did, and it works perfectly!

Hi all, this is my first time posting and I am definitely a newbie when it comes to scripting and using KM. I really appreciate all of the great tips, code, and discussions on this forum. I have implemented the above on my Mac, but the one thing I would like to do in addition is to delete the original file (I am on the (doc to docx script). I have tried inserting the rm and delete commands referring to x, theDoc, and input at various places in the script, but either it does not work (the conversion goes through) or it creates an error. Any thoughts on how to make this happen? Happy to provide more information if needed. Basically, I want to convert a doc file to a docx file and then delete the doc file.
Thanks!
Brent

Hey Brent,

Please explicitly state which script you’re using – this a long thread.

-Chris

1 Like

Chris, good point and sorry for not being more detailed. I am using the doc to docx script from calbear (that talks about converted one by one that is about six posts up from mine) and your code to run the droplet on the selection in the Finder.
Thanks!
Brent

The best way to communicate which posts/scripts/macros you are referring to is to quote the relevant portion of the post. You can easily do this by selecting the relevant text of the post, and then click on the "quote" popup, like this:

Thanks JMichaelTX.

That is a great point and makes sense. Just so I know for the future, when Chris asked for reference to which script I was using, should I have quoted the entire script? I wasn't sure if that would be necessary or clog up the thread. However, if that is easier to avoid confusion, I am happy to do so.
Thanks!

1 Like

Hey Brent,

No. Quoting a little of the post will let someone jump to it. (See the V and up-arrow icons on the right of your own quote from JM.)

-Chris

1 Like

Awesome…sorry about that, I will definitely do that moving forward. So to try to ask my original question the proper way:
I am working with the script referenced below (doc to docx): [quote=“calbear, post:38, topic:4257”]
So, just to clarify, the following script works perfectly to convert batches of hundreds/thousands of .doc files to .docx, without losing any formatting, graphics, tables, etc. I saved it as a “service” (doc2docx1by1) whereby I highlight all files in the Finder that I wish to convert and then select the “doc2docx1by1” service from the Finder’s contextual menu
[/quote]
I have it working through a service, but I would like to delete the original file after conversion. I have tried inserting the rm and delete commands referring to x, theDoc, and input at various places in the script, but either it does not work (the conversion goes through) or it creates an error. Any thoughts on how to make this happen? Happy to provide more information if needed. I have not edited the script except that at the end I pasted in the following (and just chnaged the app name to match the doctodocx name): [quote=“ccstone, post:5, topic:4257”]
here’s how to run the droplet on the selection in the Finder:
[/quote]

Basically, I want to convert a doc file to a docx file and then delete the doc file.
Thanks!
Brent

Hi Chris,
I downloaded the droplet from

I unzipped the droplet and moved it to the Application folder.

I pasted the following Apple Script to KM:

in Finder, I have a Word file selected and executed the KM macro. Then I got this error:

2021-07-21 19:09:37 Execute an AppleScript failed with script error: text-script:218:248: execution error: Word Document to .PDF Converter got an error: Connection is invalid. (-609)

What did I do wrong?

Edit:
When I drop a Word file to the droplet, I did get a PDF file. But the PDF file is broken.