Skip to content

Instantly share code, notes, and snippets.

@NigelThorne
Last active December 3, 2015 23:55
Show Gist options
  • Save NigelThorne/3830821 to your computer and use it in GitHub Desktop.
Save NigelThorne/3830821 to your computer and use it in GitHub Desktop.
Gmail behaviour in Outlook
' You need to make a mail folder called "Archive" for the emails to move into, and add this email to your menu bar and call it "&[Archive"
' You also need to open an email and add the macro to your quickbar (I expect it to be item 6, which you can check by typing 'alt')
Sub Archive()
Dim myItem
If TypeName(Application.ActiveWindow) = "Inspector" Then
Set myItem = Application.ActiveWindow.CurrentItem
myItem.UnRead = False
myItem.Move (Application.GetNamespace("MAPI").Folders("Archive"))
Else
For Each myItem In Application.ActiveExplorer.Selection
myItem.UnRead = False
myItem.Move (Application.GetNamespace("MAPI").Folders("Archive"))
Next
End If
End Sub
SendMode Input ; superior speed and reliability.
SetTitleMatchMode 2 ;allow partial match to window titles
;********************
;Hotkeys for Outlook
;********************
#include %A_ScriptDir%\_Functions
#include Edit.ahk
#IfWinActive, Inbox - [email protected] - Microsoft Outlook
^[::
SendInput {Alt Down}[{Alt Up}
return
; ]::
; SendInput {Alt Down}[{Alt Up}
; ControlGetFocus, OutputVar, Inbox - Microsoft Outlook
; if OutputVar == "" or Edit_IsReadOnly(OutputVar)
; {
; SendInput {Up}
; }
; return
;
^j::
SendInput {Down}
return
^k::
ControlGetFocus, OutputVar, Inbox - Microsoft Outlook
if Edit_IsReadOnly(OutputVar)
{
SendInput {Up}
}
return
#IfWinActive
#IfWinActive ahk_class rctrl_renwnd32
; CTRL+F does Find not Forward
;
^f::Send {Alt Down}H{Alt Up}FD
^[::
WinGetActiveTitle, WinTitle
ControlGetText, SendHWnd, Button1, %WinTitle%
if(WinTitle <> "Inbox - Microsoft Outlook" and SendHWnd <> "&Send")
{
WinGetPos, X, Y, Width, Height, %WinTitle%
SendInput {Alt Down}3{Alt Up}
WinWaitNotActive, %WinTitle%
WinActivate, ahk_class rctrl_renwnd32
SendInput {Enter}
WinWaitNotActive
WinMove, A,, %X%, %Y%, %Width%, %Height%
}
else
SendInput [
return
^]::
WinGetActiveTitle, WinTitle
ControlGetText, SendHWnd, Button1, %WinTitle%
if(WinTitle <> "Inbox - Microsoft Outlook" and SendHWnd == "" and WinTitle <> "Calendar - Microsoft Outlook")
{
WinGetPos, X, Y, Width, Height, %WinTitle%
SendInput {Alt Down}3{Alt Up}
WinWaitNotActive, %WinTitle%
WinActivate, ahk_class rctrl_renwnd32
SendInput {Up}{Enter}
WinWaitNotActive
WinMove, A,, %X%, %Y%, %Width%, %Height%
}
else
SendInput ]
return
^j::
WinGetActiveTitle, WinTitle
ControlGetText, SendHWnd, Button1, %WinTitle%
if(WinTitle <> "Inbox - Microsoft Outlook" and SendHWnd == "" and WinTitle <> "Calendar - Microsoft Outlook")
{
WinGetPos, X, Y, Width, Height, %WinTitle%
SendInput {Alt Down}{F4}{Alt Up}
WinWaitNotActive, %WinTitle%
WinActivate, ahk_class rctrl_renwnd32
SendInput {Down}{Enter}
WinWaitNotActive
WinMove, A,, %X%, %Y%, %Width%, %Height%
}
else
SendInput j
return
^k::
WinGetActiveTitle, WinTitle
ControlGetText, SendHWnd, Button1, %WinTitle%
if(WinTitle <> "Inbox - Microsoft Outlook" and SendHWnd == "" and WinTitle <> "Calendar - Microsoft Outlook")
{
WinGetPos, X, Y, Width, Height, %WinTitle%
SendInput {Alt Down}{F4}{Alt Up}
WinWaitNotActive, %WinTitle%
WinActivate, ahk_class rctrl_renwnd32
SendInput {Up}{Enter}
WinWaitNotActive
WinMove, A,, %X%, %Y%, %Width%, %Height%
}
else
SendInput k
return
#IfWinActive
;; ' You need to make a mail folder called "Archive" for the emails to move into, and add this email to your menu bar and call it "&[Archive"
;; ' You also need to open an email and add the macro to your quickbar (I expect it to be item 3, which you can check by typing 'alt')
;;
;; Sub Archive()
;; Dim myItem
;; If TypeName(Application.ActiveWindow) = "Inspector" Then
;; Set myItem = Application.ActiveWindow.CurrentItem
;; myItem.UnRead = False
;; Set Folder = Application.GetNamespace("MAPI").Folders("Archive")
;; If myItem.Parent <> Folder Then
;; myItem.Move (Folder)
;; End If
;; Else
;; For Each myItem In Application.Explorers.Item(1).Selection
;; myItem.UnRead = False
;; myItem.Move (Application.GetNamespace("MAPI").Folders("Archive"))
;; Next
;; End If
;; End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment