AutoHotKey无法与Outlook 2010一起使用


13

我创建了AutoHotKey脚本并将其编译为exe。

然后,我运行exe并运行Outlook 2010。

当我尝试使用快捷键定义时,状态栏中出现错误,提示“由于选择被锁定,不允许进行此修改。”

我已经进行了一些研究,并且将错误接缝与Trail结尾捆绑在一起。但是我在工作计算机上,没有进行试用。

有没有办法来解决这个问题?

这是我的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%
    }
}

另一个建议是,如果文档受到保护,则可能发生这种情况。我不知道这是否相关,但可以给您调查的途径吗?
斯图尔特·麦克劳克林

为什么选择“ SendMode输入”;行两次?这是故意的还是仅仅是复制和粘贴错误?
sbtkd85 2011年

这与Microsoft在2003年引入Outlook的增强安全性无关吗?

我在这里一直在争论这个问题,每次都有一个我想起的事情:为什么在地球上您不在AutoHotkey论坛上问这个问题?那里有大量针对此类问题的专业知识。
用户99572在

您是否检查过确保已激活Outlook?您可以通过转到文件->帮助进行检查。
cmorse 2011年

Answers:


1

我没有收到您的错误,但是发现了一个可能的故障点和另外两件事。可能会更正这些参数,或者至少会修改参数。

具有相关控件的清单

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

我从相关的Autohotkey文档中删除了所有空格:

以逗号分隔的字符串列表,将每个字符串与Var的内容进行比较以进行匹配。分隔逗号周围的任何空格或制表符都很重要,这意味着它们是匹配字符串的一部分。例如,如果MatchList设置为ABC,则XYZ则Var必须包含带有尾随空格的ABC或带有前导空格的XYZ才能引起匹配。

窗口检测

#IfWinActive - Microsoft Outlook ahk_class rctrl_renwnd32

运行窗口间谍时,“ NUIDocumentWindow”没有显示。键发送功能内的相关行也是如此:

IfWinActive, - Microsoft Outlook ahk_class rctrl_renwnd32
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.