Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

convert word to pdf

I recently got a new computer. Old computer - mid 2007 iMac running Mavericks (OS 10.9). New computer: late 2013 iMac running Mavericks (OS 10.9).


On my old computer I had an automator workflow/application that would convert a Word file to a pdf. It is uses an Applescript I got off the web. On my old computer I never had any problems running the script. On my new computer, which I used migration assistant to set up, I cannot get this script to run. I always get error messages.


If I try and run the workflow I get the following: Check the actionʼs properties and try running the workflow again.


If I go into automator and try and run the script I get the folllowing: Run Applescript failed - 1 error/Can't continue get default file path.


Does anyone have any idea why this won't run properly on my new computer? I am at a complete loss (not to mention, not an applescript guru...)


Any help would be greatly appreciated.


Thank you.




The applescript is below:


property theList : {"doc", "docx"}


on run {input, parameters}


set output to {}


tell application "Microsoft Word" to set theOldDefaultPath to get default file pathfile path typedocuments path


repeat with x in input


try


set theDoc to contents of x


tell application "Finder"


set theFilePath to container of theDoc as text


set ext to name extension of theDoc


if ext is in theList then


set theName to name of theDoc


copy length of theName to l


copy length of ext to exl


set n to l - exl - 1


copy characters 1 through n of theName as string to theFilename


set theFilename to theFilename & ".pdf"


tell application "Microsoft Word"



set default file pathfile path typedocuments pathpaththeFilePath


open theDoc


set theActiveDoc to the active document



save astheActiveDocfile formatformat PDFfile nametheFilename


copy (POSIX path of (theFilePath & theFilename as string)) to end of output



closetheActiveDoc


end tell


end if


end tell


end try


end repeat


tell application "Microsoft Word" to set default file pathfile path typedocuments pathpaththeOldDefaultPath


return output


end run

iMac (27-inch, Late 2013)

Posted on Nov 29, 2013 4:11 PM

Reply
6 replies

Nov 29, 2013 4:34 PM in response to LowLuster

Yes, I know how to do that. But, the above automator script is actually part of a Hazel rule that I use to convert and file away documents.


I don't want to have to open each word document and manually save. I want to put the documents into a particular folder and have Hazel run, convert the document, then file in the appropriate location.


Thank you.

Nov 30, 2013 10:26 AM in response to S. Walker

Mine also stopped working. I was loving it on Tuesday and crying about it Friday. I updated Office 2011 since then. Who knows what Apple updated in the background.


I would love to get this working again.


error message reads:

Expected end of line, etc. but found class name.


after trying to compile. The following was highlighted in the appleScript editor.


User uploaded file

gg


2012 mbpro 13 inch

Dec 1, 2013 12:50 PM in response to freshgresh

I am sorry yours script isn't working either - but it is nice to know it is not just me... :-)


I tried making a one step automator app using a Word action to simply save a Word document as a pdf. That wouldn't work either. "Automator could not convert the input data to the desired type.


So, it seems that something is definitely broken between Office 2011 and automator/applescript. Hopefully it will get sorted out.

Dec 7, 2013 1:35 PM in response to S. Walker

It has been a busy week and I hadn't had a chance to try LowLuster's latest suggestion. But, today I tried to use Word and I got an error (not associated with my attempted automation) that I essentially needed to install visual basic or some such. Note: I have not used visual basic. But, surfing around, I found that others in the past had had this problem. Some ended up uninstalling Microsoft Office and reinstalling it. So, that is what I did.


However, when it said I needed to do Update 14.3.9, I didn't install that update. Most of that update seems to be fixing issues with Outlook, which I don't use on my Mac, and crashes when using Polish, which I don't use either.


And, lo and behold, my old automation works again.


So, my advice, go through the pain on uninstalling and reinstalling Office; avoid the latest update; and go back to the old way of doing business, unless you really need the Outlook or Polish fixes.

convert word to pdf

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.