Hey apple2c1980,
Since you don’t have MS Word on the machine at work you can use the textutil
command-line-utility to transform the Word file into text.
The following script operates on a single selected file in the Finder.
It reads a .docx file and converts it to text.
It then strips any junk characters out and produces an AppleScript list.
REQUIRES that the Satimage.osax AppleScript Extension be installed for regular expression support.
tell application "Finder" to set fSel to selection as alias list
if fSel ≠{} then
set _file to quoted form of (POSIX path of first item of fSel)
set shCMD to "textutil " & _file & " -stdout -format docx -convert txt -encoding UTF-8"
set emailList to do shell script shCMD
set emailList to change "^\\W+" into "" in emailList with regexp without case sensitive
set emailList to change "\\t+" into " " in emailList with regexp without case sensitive
set emailList to change "(?m)\\A\\s+|\\s+\\Z" into "" in emailList with regexp without case sensitive
set emailList to paragraphs of emailList
end if
- The script doesn’t anticipate any possible kind of crud or irregularity that might be in the file, because I haven’t seen the files. Nevertheless oddities are easily accommodated.
Change docx to doc in the script if you need to support the old file format.
Easy enough to make the script pick the right verbiage for the two different Word file-types.
Easy enough to make the script operate on multiple files at once.
Craig has already provided a script for adding items to Contacts, so I won’t bother.
As for Mail. If you want to mess with that I’d need a bit more info.
Note that you should be using a utility to run AppleScripts via keyboard shortcuts like FastScripts or Keyboard Maestro for better productivity.
FastScripts demo mode will allow 10 keyboard shortcuts (and I believe an unlimited number of scripts), but at $9.95 US it gives a lot of bang for buck.
I’ve been using both utilities since 1993 & 1994 respectively.
If you don’t have BBEdit you should download and install its freeware sibling TextWrangler. Each app is highly scriptable and has its own script menu. They make working with plain text much more tolerable, and you could use one of them as a substitute for FastScripts or KM for this job.