Here’s a simple script to bring the main window to the front:
tell application "Microsoft Outlook" activate set WindowName to name of first main window tell application "System Events" tell process "Microsoft Outlook" click menu item WindowName of menu 1 of menu bar item "Window" of menu bar 1 end tell end tell end tell
This script works fine when triggered from within the ApplleScript Editor, or when triggered via a QuicKeys shortuct.
HOWEVER, if you put it in in the Outlook Script Menu Items folder and trigger it by selecting it from Outlooks Script Menu, it fails with the error:
“System Events can’t get menu bar 1 of process “Microsoft Outlook”. Invalid Index”
Does anyone have any idea why this is happening and how to make it so such scripts will work from the Outlook Script Menu???