Created
August 27, 2012 02:31
-
-
Save adamsmith/3485120 to your computer and use it in GitHub Desktop.
AutoHotKey script for Outlook single-button keyboard shortcuts (a, r, f, and n)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; in Outlook, a -> Archive, r -> Reply, f -> Forward, n -> New | |
; derived from http://www.autohotkey.com/community/viewtopic.php?t=41790 | |
; Note: set up Ctrl + Shift + 1 to be 'Archive' as a Quick Step for the shortcut to work | |
SendMode Input ; superior speed and reliability. | |
SetTitleMatchMode 2 ;allow partial match to window titles | |
;******************** | |
;Hotkeys for Outlook | |
;******************** | |
;As best I can tell, the window text 'NUIDocumentWindow' is not present | |
;on any other items except the main window. Also, I look for the phrase | |
; ' - Microsoft Outlook' in the title, which will not appear in the title (unless | |
;a user types this string into the subject of a message or task). | |
;#IfWinActive - Microsoft Outlook ahk_class rctrl_renwnd32 | |
#IfWinActive Microsoft Outlook ahk_class rctrl_renwnd32 | |
a::HandleOutlookKeys("^+1", "a") ;calls archive quick action | |
r::HandleOutlookKeys("^+r", "r") ;replies all to message | |
f::HandleOutlookKeys("^f", "f") ;forwards message | |
n::HandleOutlookKeys("^n", "n") ;new message | |
#IfWinActive | |
;Passes Outlook a special key combination for custom keystrokes or normal key value, depending on | |
context | |
HandleOutlookKeys( specialKey, normalKey ) { | |
;Activates key only on main outlook window, not messages, tasks, contacts, etc. | |
If WinActive("ahk_class" . "rctrl_renwnd32") and WinActive("Microsoft Outlook") | |
{ | |
;Find out which control in Outlook has focus | |
ControlGetFocus, currentCtrl | |
;MsgBox, Control with focus = %currentCtrl% | |
;set list of controls that should respond to specialKey. Controls are the list of emails and the | |
main (and minor) controls of the reading pane, including controls when viewing certain attachments. | |
;Currently I handle archiving when viewing attachments of Word, Excel, Powerpoint, Text, jpgs, | |
pdfs | |
;The control 'RichEdit20WPT1' (email subject line) is used extensively for inline editing. Thus | |
it had to be removed. If an email's subject has focus, it won't archive... | |
ctrlList = Acrobat Preview | |
Window1,AfxWndW5,AfxWndW6,EXCEL71,MsoCommandBar1,OlkPicturePreviewer1,paneClassDC1,RichEdit20WPT2,RichEdit | |
20WPT4,RichEdit20WPT5,RICHEDIT50W1,SUPERGRID1,SUPERGRID2,_WwG1 | |
if currentCtrl in %ctrlList% | |
{ | |
Send %specialKey% | |
;Allow typing normalKey somewhere else in the main Outlook window. (Like the search field or the | |
folder pane.) | |
} else { | |
Send %normalKey% | |
} | |
;Allow typing normalKey in another window type within Outlook, like a mail message, task, | |
appointment, etc. | |
} else { | |
Send %normalKey% | |
} | |
} |
When I hit on 'a' on a mail, I am able to get into the Reply mode without issues. However, when I begin to type in one of the shortcuts set for 'aw' I have set for associated with, the words do not expand. Could you please help?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I see what happened. Your comments are wrapping onto their own line (eg line 26 is wrapping onto line 28). That should probably be fixed because right now lines 28, 40, 43, etc cause compiling errors