AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Setting focus to rich edit controls in Outlook 2003

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
twwilliams



Joined: 24 May 2004
Posts: 23
Location: Bellevue, WA USA

PostPosted: Wed Jul 21, 2004 5:12 pm    Post subject: Setting focus to rich edit controls in Outlook 2003 Reply with quote

Has anyone had any success using AHK to set the focus to rich edit controls in Outlook 2003?

In particular, I'm interested in setting the focus to the Find Contact edit control in the toolbar or the Lookout search control in the Toolbar.

Window Spy detects these as RichEdit20W1 and RichEdit20W3 and ControlFocus will set focus to these controls, but they don't respond normally to typing at that point -- the Find Contact control stays greyed out and the Lookout control allows me to enter text, but not the backspace key.

I then tried ControlClick and that was even worse -- just a funny-looking cursor.

I even tried using MouseClick to click on the X,Y coordinates. It clicked there, but Outlook immediately refocused the cursor somewhere else so that I still couldn't type.

I'm trying to set up hotkeys to put the focus in these controls that don't have keyboard shortcuts, but they're defeating me.

The Help control (Type a question for help) behaves similarly.

Has anyone seen this and/or found a solution?

Here's the code (I've found that using both ControlFocus and MouseClick is more successful than not, although it only works in the Lookout control and not the native Outlook Find Contact control):

Code:

; Place focus in the Lookout search box
$^!f::
IfWinNotActive, ahk_class rctrl_renwnd32
{
    SetTitleMatchMode, 2
    IfWinNotActive, - Microsoft Outlook
    {
        Send, ^!f
        return
    }
}
ControlFocus, RichEdit20W1
MouseClick, LEFT, 745, 93
return


Thanks.
_________________
Tommy
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10464

PostPosted: Wed Jul 21, 2004 6:02 pm    Post subject: Reply with quote

Quote:
I even tried using MouseClick to click on the X,Y coordinates. It clicked there, but Outlook immediately refocused the cursor somewhere else so that I still couldn't type.

I tried it on 2002 with a plain MouseClick (with no other commands involved at all) and it worked ok: I was able to type in the box. It would surprise me if Outlook 2003 were different. This is because a MouseClick should be the same as the user physically clicking the mouse in that position.

Even so, if Outlook 2003 refuses to act properly when sent a simulated mouse click, perhaps use something like this instead:
Code:
SetTitleMatchMode, 2
IfWinNotExist, - Microsoft Outlook, , Exit
WinActivate, - Microsoft Outlook
Send, ^+f
WinWaitActive, Advanced Find
Send, !kc  ; Set to "contacts"
WinWaitActive, , This will clear your current search, 2  ; Might not need this for Outlook 2003.
Send, {enter}
Send, !ka
WinWaitActive, , This will clear your current search, 2  ; Might not need this for Outlook 2003.
Send, {enter}
Sleep, 100  ; It needs a little extra time for the below to work reliably:
WinMaximize, Advanced Find
Back to top
View user's profile Send private message Send e-mail
twwilliams



Joined: 24 May 2004
Posts: 23
Location: Bellevue, WA USA

PostPosted: Wed Jul 21, 2004 7:58 pm    Post subject: Reply with quote

Thanks for the suggestion, Chris, but that doesn't work for me because I'm looking up addresses from a global address book rather than from my Contacts. I can pull up that address book with the built-in Ctrl-Shift-B shortcut, but there are some nice things about the edit control.

Outlook 2003 is indeed different than XP: AHK moves the mouse up to the control and clicks, but the focus doesn't stay there, and Outlook even sometimes gets into a funny state until I physically click the mouse.

I think I'm going to have to work out a set of keystrokes that get me into the toolbar and then tab around to get where I want:

Code:
Send, {F10}^{TAB 2}{LEFT 7}{ENTER}


It's brittle, but as long as the order of the toolbars doesn't change, I should be set.
_________________
Tommy
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10464

PostPosted: Wed Jul 21, 2004 8:25 pm    Post subject: Reply with quote

Great idea; I'm glad Outlook at least allows that (perhaps to avoid the wrath of users with disabilities).
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group