As I don't own Outlook I tried to do the job in Mail. At front was the message created after pressing the button "Answer"
tell application "Mail" activate end tell
set newContents to "azertyuiop qsdfghjklm wxcvbn?"
tell application "System Events" to tell process "Mail" set frontmost to true # required under Yosemite, not required under El Capitan but don't hurt # Select All keystroke "a" using {command down} # Delete key code 51 using {command down} keystroke newContents keystroke return repeat with aPara in paragraphs of newContents keystroke aPara & return end repeat end tell
Running it I discovered that keystroking a text skip the embedded return characters. This is why I decided to keystroke the paragraphs one by one.
As you see, the script doesn't clobber the clipboard.
I guess that the scheme may be adapted to Outlook.
Yvan KOENIG running El Capitan 10.11.3 in French (VALLAURIS, France) vendredi 26 février 2016 15:35:13
|