Jump to content
Sign in to follow this  

AutoIt controlling Outlook is flaky..works 90% of the time

Recommended Posts


hi guys,

this is my outlook autoamtion code, to check the checkbox marked Cached Mode. The only problem is it works nearly everytime..but sometime it just misses. what i mean is..in Outlook. Click Tools -> Email Accounts, there autoit is supposed to click on Next..but sometime it misses clicking this next and my code hangs on this page. If i click Next manually, it picks up the next window and continues fine.

How do i make this less flaky and work 100% of the time...do i need to wait more before i send the ControlClick ?

Public Sub SetCachedModeOn()


autoit.WinWaitActive("E-mail Accounts")

autoit.ControlClick("E-mail Accounts", "", "12324")

autoit.WinWaitActive("E-mail Accounts", "&Change...")

autoit.ControlClick("E-mail Accounts", "", "424")

autoit.WinWaitActive("E-mail Accounts", "Use &Cached Exchange Mode")

If (autoit.ControlCommand("E-mail Accounts", "", "402", "IsChecked", "") = "0") Then

autoit.ControlCommand("E-mail Accounts", "", "402", "Check", "")

autoit.ControlClick("E-mail Accounts", "", "12324")

autoit.WinWaitActive("Microsoft Office Outlook", "The operation you selected will not complete until you choose Exit from the file menu, and then restart Microsoft Office Outlook.")

autoit.ControlClick("Microsoft Office Outlook", "", "2")

autoit.WinWaitActive("E-mail Accounts", "New &Outlook Data File...")

autoit.ControlClick("E-mail Accounts", "", "12325")




autoit.ControlClick("E-mail Accounts", "", "2")

End If

End Sub

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