Skip to content

Instantly share code, notes, and snippets.

@ckunte
Last active June 10, 2023 12:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ckunte/4f58679de506917fae17383bdc0b2691 to your computer and use it in GitHub Desktop.
Save ckunte/4f58679de506917fae17383bdc0b2691 to your computer and use it in GitHub Desktop.
Scripting replies in Outlook 2016 with AutoHotkey script
; Scripting replies in Outlook 2016 with AutoHotkey
; Hit Ctrl + Win + r to create a reply email (template) with salutation to sender's
; First Name from selected / opened email in Microsoft Outlook, which looks like this:
;
; Hi <FirstName>,
;
; Thank you for your email.
;
; <Signature appears here, if set-up in Outlook>
;
^#r::
ol := COMObjActive("Outlook.Application").ActiveExplorer.Selection.Item(1)
From := ol.SenderName
StringGetPos, pos, From, `,
if errorlevel
{
StringGetPos, pos, From, %A_Space%
StringLeft, From, From, pos
}
else
{
StringTrimLeft, From, From, pos+2
}
StringUpper From, From, T
FirstName := RegExReplace(From, " .*", "")
SendInput, ^r
Sleep, 100
SendInput, Hi %FirstName%, {Enter 2}Thank you for your email.{Enter 2}
Return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment