Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I created a AutoHotKey script and compiled it to an exe.

I then ran the exe and ran Outlook 2010.

When I try to use my hotkeys I defined I get an error in the status bar saying "This modification is not allowed because the selection is locked."

I have done some reasearch and that error seams to be tied together with a Trail ending. But I am at a work computer and I am not running a trial.

Is there a way to fix this?

here is my ahk file

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%
    }
}
share|improve this question
    
Another suggestion is that this can occur if a document is protected. I don't know if this is relevant, but may give you a route to investigate? –  Stuart McLaughlin Sep 2 '11 at 11:18
    
Why the "SendMode Input;" line twice? Is that on purpose or was it just a copy and paste error? –  sbtkd85 Sep 8 '11 at 14:12
    
Is this not related to the enhanced security introduced by Microsoft to Outlook in 2003? –  user3463 Nov 30 '11 at 23:45
    
I keep stumbling over this question here, and there is one thing that springs to my mind every time: Why on earth don't you ask this question over on the AutoHotkey forum? There is tremendous expertise over there for this kind of problems. –  user 99572 is fine Dec 5 '11 at 23:32
    
Have you check to make sure that Outlook has been activated? You can check this by going to File->Help. –  cmorse Dec 6 '11 at 16:46
show 1 more comment

1 Answer

I didn't get your error but discovered one possible point of failure and two other things. Maybe correcting those or at least playing around with the parameters.

Checklist with relevant controls

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

I removed all the spaces, citing from the relevant Autohotkey document:

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.

Window Detection

#IfWinActive - Microsoft Outlook ahk_class rctrl_renwnd32

The "NUIDocumentWindow" thing doesn't show up when I'm running window spy. Same goes for the relevant line within the key-sending-function:

IfWinActive, - Microsoft Outlook ahk_class rctrl_renwnd32
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.