Previous 1 2 3 4 5 6 Next 86 Replies Latest reply: Dec 2, 2015 7:32 PM by mohair_slim Go to original post
  • studentfromutrecht Level 1 (0 points)

    If you are looking for an easy solution, here's an Applescript applet for batch conversion of word documents (tested on doc, docx, and rtf) to PDF:


  • allan_zip Level 1 (0 points)

    Thanks for this. I'll give it a go.

  • mohair_slim Level 1 (5 points)

    Hi Spazek,


    Your convert .doc to PDF applescript worked a treat.  Brilliant.  I tried to follow it but its too much for me  I would really need a script that saves the current word document (front) as a PDF in the same folder as the current word document.  So I don't have to do: save as / PDF / in folder.  I tried for a day to invent an automator script for this but it didn't work.

  • spazek Level 2 (215 points)

    Hi mohair_slim,


    again i am not sure if i got it:

    You are talking about a current active word document that is already saved as a doc (or docx)?

    If so, try this:


    tell application "Microsoft Word"

              set theOldDefaultPath to get default file path file path type documents path


              set theDoc to path of active document as alias

              tell application "Finder"

                        set theFilePath to container of theDoc as string

                        set ext to name extension of theDoc

                        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"

              end tell


      set default file path file path type documents path path theFilePath

              set theActiveDoc to the active document

      save as theActiveDoc file format format PDF file name theFilename

      --          close theActiveDoc


      set default file path file path type documents path path theOldDefaultPath

    end tell



  • spazek Level 2 (215 points)

    Upps i mixed to scripts .. of course the one above would work too...


    tell application "Microsoft Word"

              set theDoc to path of active document as alias


              tell application "Finder"

                        set ext to name extension of theDoc

                        set x to (length of ext) + 1

                        set thePDF to (text 1 thru -x) of (theDoc as string) & "pdf"

              end tell


              set theActiveDoc to the active document


      save as theActiveDoc file format format PDF file name thePDF

              on error

                        display alert thePDF & "  already exists"

              end try

      --          close theActiveDoc


    end tell

  • mohair_slim Level 1 (5 points)

    Yes Spazek, I was talking about an already saved and open.  Thanks so much.  Trying now, fingers-crossed!

  • Jazzlady S Level 1 (0 points)


    Thanks a zillion on this.  I have a ton of documents that need to be converted to PDF and I had tried writing several versions of an automator script, and applescript, with no success.  I took what you had here and added rich text format to the file format as well.  Works BEAUTIFULLY!!!


    Thanks again for sharing!!! !|___jive_emoticon_name=grin|jivemacro=emoticon|class=jive_macro jive_emote|src=!



    BTW, This was accomplished on Lion!

  • mohair_slim Level 1 (5 points)

    Its official Spazek.  You're a star.  It worked.  I wish there was to get in touch so that I could pay you to tweak the script for me but this is a big help.  Thanks again.

  • AlexR. Level 1 (0 points)

    Spacek. Is there any way to create a prompt in the script to convert to the notes page in the PowerPoint vice the whole slide view. Any help would be greatly appreciated. Thanks.

  • gunnaregill Level 1 (0 points)

    This is very helpful. I have been trying to achieve this for some time now through Automator but finally stumbled on this thread.


    Two questions:


    1. Is it possible to amend the script so that other file formats can be channeled through it and once, f. ex. Pages or Excel?
    2. In stead of saving the PDF version in the same location, how would one change the script to that it would add a folder named "PDF" in the current location and save the docs there?


    On a different note, I seriously considering purchasing AppleScript: The Missing Manual.

  • arcuhtek Level 1 (0 points)

    I love this app but I have a serious issue and i wonder if it is the script or me.   First, it must be said that I have ZERO knowledge of scripts and only heard of "automator" today. I am new to OSX.    Let me also say that I want to batch convert multiple .doc and .docx files to PDF.  I would be happy if they convert individually to PDF but I would be more pleased of the all files selected were BOTH converted into PDF AND combined into a single PDF file.


    All of the bove having been said, my issue with the "app" posted above (I downloaded and tried it successfully...thank you) is that when it comes time to select a folder, I NEED to navigate through a lot of folders in order to get to the desired folder.  But when I click ONE folder...the very first folder....the app thinks this first folder is the folder where my desired files are stored and it takes control away from me and proceeds to the next step in the script.  My files are DEEPLY layered in my company's file server.  For example:  M:/folder1/folder2/folder3    I want to select folder 3....but when I click on folder 1 the app takes over and I cannot get to the files I need to convert.


    Let me also say, I found a work around.  But it seems unnecessary.    To get this app to work for me, I first went to finder......then I slected the exact folder I needed, which hold my DOC files and I moved it to the far left pane in FINDER under "FAVORITES."     Now, when I use the "Convert to PDF" app posted here, I simply click my desired folder under FAVORITES.   I can and I will continue to do this if I have to do so, but I think this is just a case of the app script needing updated.  (as a side note, I will also have to remove the same folder from my favorites, every time I want to use this work around method...after all, I do not want a huge list of favorites as time goes on).


    Am I the only one having this problem?  If yes, I wonder what is going on?


    Can anyone help?


    Thank you


  • Kendall Dunkelberg Level 1 (30 points)

    I was thrilled to find this script for batch converting Word files to PDF, but unfortunately it's not working for me. I wonder whether anyone has had luck with it in Mountain Lion OS X 10.8 with Word 2011 (14.2.5)?


    When I compile the script, I get an error on the line


    save as theActiveDoc file format format PDF file name theFilename


    Automator (or AppleScript) seems to expect the end of line after the first 'format." If I put "format PDF" in quotation marks, it compiles, but I still get an error on execution of the script:


           "Can't make (alias "filepath/filename") into type <<class utf8>>"


    Has anyone had these errors and/or found a solution?


    Word's automator actions for automator are all grayed out for me (on another computer, they are active, but still don't execute without an error). I also tried CUPS-PDF desktop printer -- Word opened the file, but won't print to PDF. (Neither of these solutions is related to this script, but I wanted to say what else I'd tried.)

  • sarisozen Level 1 (0 points)

    Thank you spazek,


    It's working great. Just the solution I need.

  • mohairslim Level 1 (0 points)

    Spazek, if there was some way I could send you some $ I would.  I use your script every day.  Thank you.


    The only way it could possibly be improved for me is that if you try to save and there is already a .pdf with the same name it gets an error.  In a perfect world there would be a dialog box asking if you want to replace the existing document.  Not complaining though!

  • Dan786 Level 1 (0 points)

    I will vent, but for a reason.


    I have followed all steps in entire post and I still do not have a functioning app/workflow (I really don't care how this is called; I just need it to work). I also downloaded script that someone else posted and it is NOT working.


    I'm not sure why with all the geeks ot there it is so difficult to construct a SIMPLE, FUNCTIONING (=works on latest iOS) application or workflow (call it whatever you want) IN ONE SINGLE POST, as opposed to posting FRAGMENTS of codes that do nothing but confuse the end user and take hours to put together; and force most in the position where opening each and every doc file and saving it as PDF is far more time efficient than reading through these posts that provide variations upon variations of NON-functioning advice.


    It's plain and simple: this is what is needed- because this is exactly what Adobe Prof offers.


    IOS 10.8.2

    Office 2011


    (1) (multiple) select doc/docx files in Finder

    (2) right click

    (3) choose an option to convert from doc to PDF

    (4) option runs and

         (4) a: takes all doc/docx files

         (4) b: converts files to PDF (does NOT delete doc. files)

         (4) c: puts newly created PDF files INTO SAME FOLDER WHERE DOC/DOCX files are.


    Is is so difficult to create ONE post that, in ONE PLACE explains step-by-step how and app/workflow achieves steps listed (1)-(4)?