Applescript to periodically raise unsent Outlook replies to the foreground


I’ve had a particular problem starting replies in Outlook for Mac and then losing track of them or forgetting about them.

This script is a fairly naive attempt at having such replies raised to the foreground. It doesn’t distinguish between a reply you’re reading and one you’re writing. It also won’t notice email that you’re composing that *doesn’t* have a ‘Re:’ as the start of the title. I imagine there’s a window property that I can look for to select those, I just didn’t want to go there yet.

The script also unintelligently repeats every 60 seconds, which I figure is better than leaving an email unsent for 2 hours.

I’m publishing updates to my “applefritters” project on GitHub if you want to keep up with further improvements to this script.

repeat
	tell application "System Events"
		tell process "Microsoft Outlook"
			repeat with aWindow in (get every window)
				set aName to get the name of aWindow
				set initialName to ((characters 1 through 3 of aName) as string)
				if (initialName = "Re:") then
					tell application "Microsoft Outlook"
						activate
					end tell
					activate aWindow
					set frontmost to true
					perform action "AXRaise" of aWindow
					exit repeat -- only activate one window
				end if
			end repeat
		end tell
	end tell
	delay 60
end repeat

%d bloggers like this: