View calendar for current event invite in Entourage

Hi all.

I’m an Applescript newbie who is trying to improve the quality of Entourage X (having been an Outlook user for a while). When I get an event invite, I would like to invoke an AppleScript to move to the Calendar view (apple 3) and show the event in the week view (so I can judge whether to accept it or not).

I can do the move to calendar view

tell application "System Events" to keystroke "3" using {command down}

but I can’t wrap my head around the object model for Entourage to extract the start date of an event embedded inside a message.

Any help will be truly appreciated.

Thanks in advance

Graeme

Hi all

I’ve come up with one solution which uses UI scripting and looks a bit clunky when it operates (you see the menus being selected etc). For the record, here it is:

try
	tell application "Microsoft Entourage"
		activate
		set theSelection to current messages
		repeat with theCurrentMessage in theSelection
			set theStartDate to the remind date and time of theCurrentMessage
		end repeat
		
		-- change to calendar view
		tell application "System Events" to keystroke "3" using {command down}
		-- change to week to a page view
		tell application "System Events" to keystroke "2" using {command down, control down}
		-- select the View a date menu item
		tell application "System Events" to keystroke "T" using {command down, shift down}
		-- type in the start date of the event and then press return
		tell application "System Events" to keystroke theStartDate
		tell application "System Events" to keystroke return
		
	end tell
end try

If anyone has a neater solution, I’d be very interested to hear about it.

Thanks

Graeme

I know it looks like I’m tinkering now, but I found that the version I just posted has a minor problem: when I return to email view in Entourage, the original message (which I used to send me to the calendar view) has been deselected. Far from intuitive.

If I move the ‘end repeat’ to just before the ‘end tell’ then when I return to mail view, I get a neighbour message highlighted, but I have yet to figure out how to preserve state, as it were (and I know it is not real state preservation before anyone flames me).

Thanks again, if there are any helpful souls out there.

Graeme