Convert WordPerfect Docs to Word Docs in Bulk

Convert WordPerfect Docs to Word Docs in Bulk

A couple of months ago, I shared an AppleScript/Folder Action that enables you to convert Pages documents to Word documents, whether one at a time or in bulk. I now present you with a script I put together that will convert those pesky Word Perfect documents to Word documents.

As you know, I have joined a firm that runs primarily on Windows. I’m the only Mac in the place, and pretty much everyone there uses WordPerfect. Of course, simply opening and/or editing WordPerfect docs on a Mac is no problem, since there are a number of applications that can handle them (AbiWord, OpenOffice.org, NeoOffice, etc.). The Mac Lawyer recently had a post detailing even more ways to access WordPerfect files on your Mac.

I wanted to take the solution one step further, and provide a quick and easy way to convert multiple WordPerfect documents to Word documents in one fell swoop.

My weapon of choice this time is AbiWord.

This script isn’t quite as elegant as the Pages to Doc script, since AbiWord is not actually AppleScriptable. This basically means that instead of simply telling the application to “save” the file or “save as…” AppleScript has to go through a series of automated keystrokes to get the job done. The end result is essentially the same, but the code just looks a bit uglier.

So, here’s the code, if you’re interested:

on adding folder items to this_folder after receiving added_items
repeat with i from 1 to number of items in added_items
set this_item to item i of added_items
tell application “AbiWord”
open this_item
tell application “AbiWord”
activate
end tell
delay 2
tell application “System Events”
key code 1 using {command down, shift down}
delay 1
key code 2 using {command down}
key code 124
key code 51
key code 51
key code 51
key code 2
key code 31
key code 8
key code 36
key code 13 using {command down}
delay 2
end tell
end tell
end repeat
end adding folder items to

You can recreate the script yourself by pasting this text into your AppleScript Editor and saving it. If you want to know the ugly details, this script is literally just going through the manual steps, one by one: opening the file, hitting command-shift-s (“Save As…”), command-d (to set the path to the desktop), right-arrow (to set the cursor to the end of the filename), delete-delete-delete (to delete the “wpd” from the end), d-o-c (to put “doc” at the end), return (to complete the save), and command-w (to close the document), then repeating. I told you it was ugly, but it gets the job done!

After you have your script, place it in Macintosh HD/Library/Scripts/Folder Action Scripts. When you have done that, right click on the folder you would like to be your “drop” folder, and select “Folder Actions Setup…” as seen below.

Select the script you just created (or downloaded), and click “Attach” as shown below.

And, you’re done! To test this, just drag one or more WP docs into the folder and see if AbiWord goes through its paces to save your new Word docs to the desktop.

You will probably experience a glitch from time to time, so, you’ll want to keep an eye on the process as it’s unfolding to make sure nothing goes wrong. Also, although it should probably go without saying, keep your hands off your computer until the process is completed. Any interrupting clicks/keystrokes will probably throw the whole thing off course.

One final thing I did to streamline things was to place this folder in the right or bottom side of my dock so that it’s always there for quick access for me to dump WP files into when needed.

Leave a Reply

Your email address will not be published. Required fields are marked *