I have this script to download Outlook email and it is behaving different since upgrade to OS 11
I have set my Mac to have 3 desktops. Outlook is showing exclusively on Desktop 1.
Under OS 10.6 when I ran the script below it would switch to the Outlook application on Desktop 1. Now under OS 11 it does download the new email but no longer switches to Desktop 1.
Is there a fix that anybody knows of?
tell application "System Events"
tell application "Microsoft Outlook" to activate
tell application "Microsoft Outlook"
if it is running then
activate
end if
tell application "System Events"
keystroke (ASCII character 107) using control down & command down
end tell
end tell
end tell
I experimented with this last nicht and I managed. Maybe not the most elegant script but it works.
tell application "Microsoft Outlook" to activate
-- bring it to the front
tell application "System Events"
tell application process "Microsoft Outlook"
set frontmost to true
end tell
end tell
--run send and receive
tell application "System Events"
tell application "Microsoft Outlook" to activate
tell application "Microsoft Outlook"
if it is running then
activate
end if
tell application "System Events"
keystroke (ASCII character 107) using control down & command down
end tell
end tell
end tell
-- go to the Desktop were Outlook runs
repeat 2 times
tell application "System Events" to key code 123 using control down
end repeat
If you select the checkbox “When switching to an application…” in System Preferences/Mission Control…
Then this following Applescript should work for you.
tell application "Microsoft Outlook" to activate
tell application "System Events"
tell application process "Microsoft Outlook"
set frontmost to true
repeat until frontmost
delay 0.1
end repeat
end tell
delay 0.1
keystroke character id 107 using {control down, command down}
end tell