« VBSEdit: so far, so good | Main | Chapter 13 (disaster recovery) submitted »
March 31, 2004
And now for a completely different kind of script…
I frequently work on a Mac running Mac OS X. I needed a way to grab the current open document in Word and attach it to the current message in Entourage (Microsoft's equivalent of Outlook for the Mac). This turned out to be a fairly simple task in AppleScript, which I don't savvy at all. Here's what I came up with:
tell application "Microsoft Word"
set attachName to full name of active document
if attachName is {} then return
end telltell application "Microsoft Entourage"
set newMsg to window 1
if class of newMsg ≠ draft window then return
make new attachment at newMsg with properties {file:attachName}
end tell
It's pretty simple: get the active Word document if one exists and tack it onto the frontmost draft message window in Entourage. It could undoubtedly be improved, but as is it's pretty useful. I'll probably use this almost as much as the "dial the phone number of the selected contact" script I snagged from Simon Dorfman.
Posted by Paul at March 31, 2004 01:31 PM