Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

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

Converting Word 5.1 files with Applescript

As Microsoft office 2011 currently no longer support Word 5.1 I'm using the previous Office 2004. I can read 5.1 files and saved themmanually as .doc files on Snow Leopard.

However the files are many and I have this script

set inputfolder to (choose folder) as text

set destFolder to (choose folder) as text

set theFiles to list folderinputfolder without invisibles

activateapplication "Word"


repeat with x from 1 to count of theFiles

set thefile to itemx of theFiles

set inputfile to (inputfolder & thefile)

tell application "Word"


opendocumentinputfile

save document 1 in (destFolder & thefile & ".doc")


closedocument 1 savingno

end tell

end repeat



Trying to open the files I need to convert and save them in a different folder.


However I always get an error from AppleScript Version 2.3 (118)


error "Microsoft Word got an error: document \"Disk:Word_Files:a: New Files:General Stuff:conv\" doesn’t understand the open message." number -1708 from document "Disk:Word_Files:a: New Files:General Stuff:conv"


If anyone can help or give another solution to batch convert I will be very glad and happy new Year to all

Mac Pro, Mac OS X (10.6.8)

Posted on Dec 27, 2011 5:37 PM

Reply
4 replies

Dec 28, 2011 7:45 PM in response to etnad

Thanks all however if anyone is interested this is the solution it works till the current office version:



set inputfolder to (choose folder) as text

set destFolder to (choose folder) as text

set theFiles to list folderinputfolder without invisibles

activateapplication "Microsoft Word"


repeat with x from 1 to count of theFiles

set thefile to itemx of theFiles

set inputfile to (inputfolder & thefile)

tell application "Microsoft Word"


openfileinputfile


save asdocument 1 file name (destFolder & thefile & ".doc")


closedocument 1 savingno

end tell

end repeat



The only drawback is:

if the selected destination folder is inside the input folder the script will give error and stop

however this doesn't happen if the "destination folder" is somewhere elese from the selected input folder


Regards and Happy new year

Jul 22, 2013 5:07 PM in response to etnad

Even when using etnad's revised script posted on Dec. 28, 2011 7:45 PM, I always get the error message, "Microsoft Word got an error: "Planet OS X:InputAttyRet. Agr (Davis)" doesn't understand the open message.


(I'm using AppleScript Utility Ver. 1.0 and Script Editor 2.1.1 in OS 10.4.11.)


Here's the script I am using:


set inputfolder to ("Planet OS X:Input")

set destFolder to ("Planet OS X:output")

set theFiles to list folder inputfolder without invisibles

activate application "Microsoft Word"

repeat with x from 1 to count of theFiles

set thefile to item x of theFiles

set inputfile to (inputfolder & thefile)

tell application "Microsoft Word"

open file inputfile

save as document 1 file name (destFolder & thefile & ".doc")

close document 1 saving no

end tell

end repeat


I'm a real newbie at AppleScript, and all suggestions will be appreciated.

Converting Word 5.1 files with Applescript

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