About the Author
Esquire | Mac is a blog by Adam Greivell, a 20+ year Mac veteran and Maryland litigation attorney. Adam practices law primarily in Hagerstown, Maryland. Macs are his weapons of choice.
Email Adam
Follow Adam on Twitter
Click here for more about Adam...
Subscribe to this Blog
Search
The Twitters
Disclaimers

(1) It should go without saying, but, I'm a lawyer and I can't keep from saying it: This site is for informational purposes, and is not to be construed as legal advice. I can't imagine how anyone could possibly think anything here equates to legal advice, but in case you did: it doesn't. 
(2) Although I work for the above referenced law firm, this site is not affiliated in any way with that firm. This site is solely a personal endeavor. 
(3) This site has nothing to do with the magazine "Esquire" or esquire.com. Esquire is used in the title here in a purely descriptive sense invoking the traditional definition of the word as a label for an attorney.

Sunday
Nov222009

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, which you can download here (direct download link).


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, or, you can just download it from here. 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.




« Herald Bumps Apple Mail Notification Up A Notch | Main | Convert Pages Docs to Word Docs En Masse »

Reader Comments (3)

[...] This post was mentioned on Twitter by Adam Greivell, Grace McCrorie. Grace McCrorie said: New blog post: Convert WordPerfect Docs to Word Docs in Bulk http://tr.im/FzlE (via @esquiremac) [...]

Thanks for the text you supplied. I just recreated the script by pasting it into my AppleScript Editor.

Much Obliged !

Jakk

January 1, 2010 | Unregistered CommenterTechnology Blogged

THANKS FOR THE WALK-THROUGH! I am learning how to be savvy with the Mac and this helped immensely!

November 1, 2011 | Unregistered CommenterCharles

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>