Jump to content
Sign in to follow this  

ControlClick in Outlook 2003

Recommended Posts


hello there,

I used to work with v2 some time ago, now I turn to v3 after a long pause. I am not a very versatile programmer and I do have a problem I would like to ask you for help. please note that I *have* consulted the search function of this board, but I did not find a suitable answer (some hints though, which I tried, but failed).

ok, all I want at this moment is to click this button, marked with a red arrow below:

Posted Image

some results of my digging into autoitv3 and the board to solve this.

- Au3Info result see below

- There is no Control ID, so I was trying with ClassNameNN: MsoCommandBar2 and Text:Desktop SMS (ClassNameNN seems to change from MsoCommandBar2 to MsoCommandBar3 now and then)

- as you see in the screenshot, the button text is "New SMS". I tried that too.

- Desktop SMS is a COM Add-In from RedOxygen. It does not publish any COM interface (not even vor buttonclick), so I cannot go that way.

basically, I tried with the following two lines after I have put the outlook window to the foreground. I tried several iterations, each time changing the Text or ClassNameNN to figure out what would work. unfortunately, none of my approaches worked.

ControlFocus("Microsoft Outlook", "New SMS", "MSOCommandBar1")
ControlClick("Microsoft Outlook", "New SMS", "MSOCommandBar1")

and iterations like
ControlFocus("Microsoft Outlook", "Desktop SMS", "MSOCommandBar1")
ControlFocus("Microsoft Outlook", "New SMS", "MSOCommandBar3")
ControlFocus("Microsoft Outlook", "New SMS", "MSOCommandBar1")

then I tried AutoHotKey. somewhere is an example with "Postmessage" mentioned (btw, is there an equivalent in autoit3?). I tried with the tool "Winspector Spy" to learn more about this button.

what I found:

- there is no WM_COMMAND or WM_LBDOWN event.

- there are only a lot of WM_USER type events

which meant, in the case of AutoHotKey, I could not use the Postmessage function.

yeah, I could use MouseMove and click afterwards, but unfortunately, the button might be somewhere else, depending how big the window is or if its eventually closed.

so, any chance I can click that button? any help is appreciated.

ah.. this is only part of the little script I am workling on. but this part here seems most challenging to me.


>>>>>>>>>>>> Window Details <<<<<<<<<<<<<
Title:  Almost All - Microsoft Outlook
Class:  rctrl_renwnd32
Size:   X: -4   Y: -4   W: 1003 H: 748

>>>>>>>>>>> Mouse Details <<<<<<<<<<<
Screen: X: 800  Y: 55
Cursor ID:  2

>>>>>>>>>>> Pixel Color Under Mouse <<<<<<<<<<<
RGB:    Hex: 0x000000   Dec: 0

>>>>>>>>>>> Control Under Mouse <<<<<<<<<<<
Size:       X: 749  Y: 24   W: 93   H: 26
Control ID: 
ClassNameNN:    MsoCommandBar2
Text:       Desktop SMS
Style:      0x56000000
ExStyle:        0x00000000

>>>>>>>>>>> Status Bar Text <<<<<<<<<<<
(1): 363 Items

>>>>>>>>>>> Visible Window Text <<<<<<<<<<<
Desktop SMS
Type a contact to find
Menu Bar
Type a question for help
363 Items
Table View

>>>>>>>>>>> Hidden Window Text <<<<<<<<<<<
Edited by igrok

Share this post

Link to post
Share on other sites


If ControlFocus() is working (it gets focus)

then try to use Send("{Enter}") or Send("{Space}") instead of ControlClick()

or try to use ControlGetHandle() and _SendMessage(..,WM_COMMAND,..) --> ID from Winspector

I know it's not elegamt but the last idea...

EDIT: _SendMessage is in standard UDF in latest Autoit 3.2 beta so it's no need to go away from AU3 to AHK :whistle:

Edited by Zedna

Share this post

Link to post
Share on other sites

You might look into use COM obj for example http://www.autoitscript.com/forum/index.ph...st&p=262557

see my signature for info on Office 2003


I was searching for some ObjCreate( "Outlook.Application" ) stuff and found this post and also yours nice example.

But igrok said it is plugin without exposed COM so probably it's not so simple.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this