Outlook 2011 script stopped working

I am using 14.7.7 version. The script below all of a sudden stopped working. it is designed to do a ‘Send and Receive all’. I can not figure out why and maybe someone here has an idea.

The error I get is:

error “System Events got an error: AppleEvent timed out.” number -1712

tell application "System Events"
	tell application "Microsoft Outlook" to activate
	tell application "Microsoft Outlook"
		if it is running then
		end if
		tell application "System Events"
			keystroke (ASCII character 107) using command down
		end tell
	end tell
end tell

Thanks in advance for your help.

I don’t know if this will fix your problem (there could be some other underlying issues that’s causing it to slow down in the first place) but to stop getting the ‘timed out’ error you can encase your code in a block like this:

with timeout of 600 seconds
end timeout

Now your script will keep trying to make it happen for a whole ten minutes before giving up instead of the default of two

It’s not very nice code with those double-nested tells and long-deprecated ASCII character command. Does it work any better like this?:

tell application "Microsoft Outlook" to activate
tell application "System Events" to keystroke "k" using {command down}

I don’t have Outlook. I presume it doesn’t have any sort of connect command in its scripting dictionary.