AutoHotKey não funciona com o Outlook 2010

13

Eu criei um script AutoHotKey e o compilei para um exe.

Em seguida, executei o exe e executei o Outlook 2010.

Quando tento usar minhas teclas de atalho, defini que recebo um erro na barra de status dizendo "Esta modificação não é permitida porque a seleção está bloqueada".

Eu fiz algumas pesquisas e esse erro parece vinculado a um final de Trail. Mas estou em um computador de trabalho e não estou fazendo um teste.

Existe uma maneira de corrigir isso?

aqui está o meu arquivo ahk

SendMode Input ; Recommended for new scripts due to its superior speed and reliability.

SendMode Input ; superior speed and reliability.

SetTitleMatchMode 2 ;allow partial match to window titles

;********************
;Hotkeys for Outlook 2010
;********************
;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, NUIDocumentWindow

y::HandleOutlookKeys("!hy", "y") ;calls archive macro
f::HandleOutlookKeys("^f", "f") ;forwards message
r::HandleOutlookKeys("^r", "r") ;replies to message
a::HandleOutlookKeys("^+r", "a") ;reply all
v::HandleOutlookKeys("^+v", "v") ;Move message box
+u::HandleOutlookKeys("^u", "+u") ;marks messages as unread
+i::HandleOutlookKeys("^q", "+i") ;marks messages as read (^q is read/unread toggle)
j::HandleOutlookKeys("{Down}", "j") ;move down in list
+j::HandleOutlookKeys("{Down}{Enter}", "+j") ;move down and select next item
k::HandleOutlookKeys("{Up}", "k") ;move up
+k::HandleOutlookKeys("{Up}{Enter}", "+k") ;move up and select next item
o::HandleOutlookKeys("^o", "o") ;open message
s::HandleOutlookKeys("{Insert}", "s") ;toggle flag (star)
c::HandleOutlookKeys("^n", "c") ;new message
/::HandleOutlookKeys("^e", "/") ;focus search box
.::HandleOutlookKeys("+{F10}", ".") ;Display context menu

#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.
    IfWinActive, – Microsoft Outlook ahk_class rctrl_renwnd32, NUIDocumentWindow, ,
    {
        ;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, RichEdit20WPT4, 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%
    }
}
    
por Chris Watts 01.07.2011 / 19:57

1 resposta

1

Eu não recebi o erro, mas descobri um possível ponto de falha e duas outras coisas. Talvez corrigi-los ou, pelo menos, brincar com os parâmetros.

Lista de verificação com controlos relevantes

ctrlList = Acrobat Preview Window1,AfxWndW5,AfxWndW6,EXCEL71,MsoCommandBar1,OlkPicturePreviewer1,paneClassDC1,RichEdit20WPT2,RichEdit20WPT4,RichEdit20WPT5,RICHEDIT50W1,SUPERGRID1,SUPERGRID2,_WwG1

Eu removi todos os espaços, citando o documento Autohotkey relevante:

A comma-separated list of strings, each of which will be compared to the contents of Var for a match. Any spaces or tabs around the delimiting commas are significant, meaning that they are part of the match string. For example, if MatchList is set to ABC , XYZ then Var must contain either ABC with a trailing space or XYZ with a leading space to cause a match.

Detecção de janelas

#IfWinActive - Microsoft Outlook ahk_class rctrl_renwnd32

A coisa "NUIDocumentWindow" não aparece quando estou executando o Window Spy. O mesmo vale para a linha relevante dentro da função de envio de chave:

IfWinActive, - Microsoft Outlook ahk_class rctrl_renwnd32
    
por 12.12.2011 / 12:52