Need Help Scripting in Word

I am taking the selected text from Mail and want to paste it into a word doc. I need to change the font size to 12, save the document as a word97 document (.doc) and then mail it as an attachment to a specific address. I am trying to get each piece of this to go and learn along the way. So far, this is what I have. Of course it doesn’t work, that’s why I need the help.

tell application “Mail”
activate
tell application “System Events”
tell process “Mail”
keystroke “c” using {command down}
end tell
tell application “Microsoft Word”
activate
tell application “System Events”
tell process “Microsoft Word”
keystroke “v” using {command down} --hopefully this will paste the clipboard contents
–previously copied
end tell

		end tell
		save as file name "~/documents/huddle.doc" file format format document97 -- doesn't work
	end tell
end tell

end tell

Thanks.

Why don’t you just say “save” and not have it ending in “file format …”

Also, put a delay after the 8 line (activate) so that Word can “BREATHE” (more like hog up all the air) and open. And, it needs to be a AppleScript path (forgot what it’s called :P)

Hi,

.doc is the default file format
MS Word is pretty scriptable so this weird GUI scripting is not needed
Try this


activate application "Mail"
tell application "System Events"
	tell process "Mail"
		keystroke "c" using {command down}
	end tell
end tell
tell application "Microsoft Word"
	activate
	if not (exists document 1) then
		make new document
	end if
	paste special text object of document 1 data type paste text
	tell text object of document 1 to set font size of font object to 12.0
	save document 1 in ((path to documents folder as text) & "huddle.doc")
end tell

the activate command waits always until the application has taken the “breath”

HFS path