Applescript to make format of current message Plain Text

Hello!

How could I use applescript to make the formatting of the currently open Outlook 2016 message Plain Text (whether it is already plain text OR html)?

Background:

I’m using Keyboard Maestro to take my replies in Outlook for Mac 2016 to BBEdit for editing/composing. The script works when the message I’m copying from is in Plain Text. However, I sometimes need to reply in Outlook keeping the HTML formatting. Therefore, I can’t set Outlook to always reply in plain text - I have to use “reply in the format of original message”. It would be nice if my script could just use the shift+command+T menu to make the reply message plain text prior to sending me to BBEdit, however this menu is a toggle < html <-> plain text >, and so it will not only make HTML message plain text, but also make plain text messages html . So I just need to call a quick AppleScript to make the currently open Outlook message formatted as plain text.

Applescript baffles me, but I’m assuming the basic outline will look like

tell application “Microsoft Outlook”
set objMessage to item 1 of (get current messages)
end tell

but I need the line that makes the message Plain Text. I Google up some thread that included “… set the property to {plain text content:the_Content}…” But I’m not sure what to do with that.

Any help would be greatly appreciated.

Thanks!

Model: MBP
Browser: Safari 601.6.17
Operating System: Mac OS X (10.10)

Hi there,
I use the code below to get the content of an html email as plain text.

Select an email and run the script below.
The clipboard should contain the plain text content of the email.


tell application "Microsoft Outlook"
	activate
	set thisMessage to selection
	set ptContent to plain text content of thisMessage
end tell
set the clipboard to ptContent

HTH

With AppleScriptObjC you can use appkits extension on NSAttributedString. You can send and HTML string to it and get the plain string back from it. In this post i wrote an example.